niwrap.c3d.c3d
1# This file was auto generated by Styx. 2# Do not edit this file directly. 3 4import typing 5import pathlib 6from styxdefs import * 7import dataclasses 8 9C3D_METADATA = Metadata( 10 id="58e07723e7477ee290e9447fb17235326c45f8c8.boutiques", 11 name="c3d", 12 package="c3d", 13 container_image_tag="pyushkevich/itksnap:v3.8.2", 14) 15 16 17@dataclasses.dataclass 18class C3dAccum: 19 """ 20 -accum, -endaccum: Accumulate operations over all images 21 22 Syntax: `-accum command-list -endaccum` 23 24 Apply a binary operation (such as addition or multiplication) to all the 25 images on the stack in a cumulative fashion. The command(s) will be applied 26 to the last and second-to-last images on the stack, then to the result of 27 this operation and the third-to-last image on the stack and so on. Below is 28 the example of using the command to add multiple images. 29 30 c3d image*.nii -accum -add -endaccum -o sum.nii. 31 """ 32 accum: str 33 """-accum, -endaccum: Accumulate operations over all images 34 35 Syntax: `-accum command-list -endaccum` 36 37 Apply a binary operation (such as addition or multiplication) to all the 38 images on the stack in a cumulative fashion. The command(s) will be applied 39 to the last and second-to-last images on the stack, then to the result of 40 this operation and the third-to-last image on the stack and so on. Below is 41 the example of using the command to add multiple images. 42 43 c3d image*.nii -accum -add -endaccum -o sum.nii""" 44 45 def run( 46 self, 47 execution: Execution, 48 ) -> list[str]: 49 """ 50 Build command line arguments. This method is called by the main command. 51 52 Args: 53 execution: The execution object. 54 Returns: 55 Command line arguments 56 """ 57 cargs = [] 58 cargs.extend([ 59 "-accum", 60 self.accum 61 ]) 62 return cargs 63 64 65@dataclasses.dataclass 66class C3dAcos: 67 """ 68 No description found. 69 """ 70 acos: str 71 """No description found.""" 72 73 def run( 74 self, 75 execution: Execution, 76 ) -> list[str]: 77 """ 78 Build command line arguments. This method is called by the main command. 79 80 Args: 81 execution: The execution object. 82 Returns: 83 Command line arguments 84 """ 85 cargs = [] 86 cargs.extend([ 87 "-acos", 88 self.acos 89 ]) 90 return cargs 91 92 93@dataclasses.dataclass 94class C3dAdd: 95 """ 96 -add: Voxelwise image addition 97 98 Syntax: `-add` 99 100 Adds the last two images on the stack, and places the sum at the end of the 101 stack. 102 103 # Add two images: x = a + b 104 c3d a.img b.img -add -o x.img 105 106 # Add three images, x = (a + b) + c in the first example, x = a + (b + c) in 107 the second 108 c3d a.img b.img -add c.img -add -o x.img 109 c3d a.img b.img c.img -add -add -o x.img 110 111 # Subtract two images, using -scale command: x = a - b 112 c3d a.img b.img -scale -1 -add -o x.img. 113 """ 114 add: str 115 """-add: Voxelwise image addition 116 117 Syntax: `-add` 118 119 Adds the last two images on the stack, and places the sum at the end of the 120 stack. 121 122 # Add two images: x = a + b 123 c3d a.img b.img -add -o x.img 124 125 # Add three images, x = (a + b) + c in the first example, x = a + (b + c) in 126 the second 127 c3d a.img b.img -add c.img -add -o x.img 128 c3d a.img b.img c.img -add -add -o x.img 129 130 # Subtract two images, using -scale command: x = a - b 131 c3d a.img b.img -scale -1 -add -o x.img""" 132 133 def run( 134 self, 135 execution: Execution, 136 ) -> list[str]: 137 """ 138 Build command line arguments. This method is called by the main command. 139 140 Args: 141 execution: The execution object. 142 Returns: 143 Command line arguments 144 """ 145 cargs = [] 146 cargs.extend([ 147 "-add", 148 self.add 149 ]) 150 return cargs 151 152 153@dataclasses.dataclass 154class C3dAlignLandmarks: 155 """ 156 -alm, -align-landmarks: Align images based on landmark matching 157 158 Syntax: `-alm dof outfile` 159 160 Performs rigid or affine alignment between to sets of landmark images. A 161 landmark image is an image where for every intensity value, the centroid of 162 all voxels with that intensity represents a landmark. Landmarks can be 163 created using the paintbrush tool in ITK-SNAP (they can be spheres, cubes, 164 etc). The first image on the stack is the target/fixed/reference image, and 165 the second is the moving image. The parameters are the degrees of freedom, 166 which is a number (6 for rigid, 7 for rigid+scale, 12 for affine) and the 167 output matrix file. In this example, we have images **fixed.nii* and 168 **moving.nii** with corresponding landmark images. We use landmarks to align 169 the moving image to the fixed: 170 171 c3d fixed_landmarks.nii moving_landmarks.nii -alm 6 rigid.mat 172 c3d fixed.nii moving.nii -reslice-matrix rigid.mat -o 173 moving_resliced_to_fixed.nii. 174 """ 175 align_landmarks: str 176 """-alm, -align-landmarks: Align images based on landmark matching 177 178 Syntax: `-alm dof outfile` 179 180 Performs rigid or affine alignment between to sets of landmark images. A 181 landmark image is an image where for every intensity value, the centroid of 182 all voxels with that intensity represents a landmark. Landmarks can be 183 created using the paintbrush tool in ITK-SNAP (they can be spheres, cubes, 184 etc). The first image on the stack is the target/fixed/reference image, and 185 the second is the moving image. The parameters are the degrees of freedom, 186 which is a number (6 for rigid, 7 for rigid+scale, 12 for affine) and the 187 output matrix file. In this example, we have images **fixed.nii* and 188 **moving.nii** with corresponding landmark images. We use landmarks to align 189 the moving image to the fixed: 190 191 c3d fixed_landmarks.nii moving_landmarks.nii -alm 6 rigid.mat 192 c3d fixed.nii moving.nii -reslice-matrix rigid.mat -o 193 moving_resliced_to_fixed.nii""" 194 195 def run( 196 self, 197 execution: Execution, 198 ) -> list[str]: 199 """ 200 Build command line arguments. This method is called by the main command. 201 202 Args: 203 execution: The execution object. 204 Returns: 205 Command line arguments 206 """ 207 cargs = [] 208 cargs.extend([ 209 "-align-landmarks", 210 self.align_landmarks 211 ]) 212 return cargs 213 214 215@dataclasses.dataclass 216class C3dAnisotropicDiffusion: 217 """ 218 -add: Voxelwise image addition 219 220 Syntax: `-add` 221 222 Adds the last two images on the stack, and places the sum at the end of the 223 stack. 224 225 # Add two images: x = a + b 226 c3d a.img b.img -add -o x.img 227 228 # Add three images, x = (a + b) + c in the first example, x = a + (b + c) in 229 the second 230 c3d a.img b.img -add c.img -add -o x.img 231 c3d a.img b.img c.img -add -add -o x.img 232 233 # Subtract two images, using -scale command: x = a - b 234 c3d a.img b.img -scale -1 -add -o x.img. 235 """ 236 anisotropic_diffusion: str 237 """-add: Voxelwise image addition 238 239 Syntax: `-add` 240 241 Adds the last two images on the stack, and places the sum at the end of the 242 stack. 243 244 # Add two images: x = a + b 245 c3d a.img b.img -add -o x.img 246 247 # Add three images, x = (a + b) + c in the first example, x = a + (b + c) in 248 the second 249 c3d a.img b.img -add c.img -add -o x.img 250 c3d a.img b.img c.img -add -add -o x.img 251 252 # Subtract two images, using -scale command: x = a - b 253 c3d a.img b.img -scale -1 -add -o x.img""" 254 255 def run( 256 self, 257 execution: Execution, 258 ) -> list[str]: 259 """ 260 Build command line arguments. This method is called by the main command. 261 262 Args: 263 execution: The execution object. 264 Returns: 265 Command line arguments 266 """ 267 cargs = [] 268 cargs.extend([ 269 "-anisotropic-diffusion", 270 self.anisotropic_diffusion 271 ]) 272 return cargs 273 274 275@dataclasses.dataclass 276class C3dAntialias: 277 """ 278 No description found. 279 """ 280 antialias: str 281 """No description found.""" 282 283 def run( 284 self, 285 execution: Execution, 286 ) -> list[str]: 287 """ 288 Build command line arguments. This method is called by the main command. 289 290 Args: 291 execution: The execution object. 292 Returns: 293 Command line arguments 294 """ 295 cargs = [] 296 cargs.extend([ 297 "-antialias", 298 self.antialias 299 ]) 300 return cargs 301 302 303@dataclasses.dataclass 304class C3dSet: 305 """ 306 -as: Assign image at the end of the stack to a variable 307 308 Syntax: `-as var` 309 310 Associates the image currently at the end of the stack with variable name 311 'var'. This allows you to retrieve the image later on the command line using 312 the **-push** command. The **-as** and **-push** commands are useful when 313 you need to use a certain image more than once during a convert3d operation. 314 For example, if you want to compute the distance transform of a binary image 315 and mask it so that the values outside of the binary image region have value 316 0, you would use the following command: 317 318 c3d binary.img -as A -sdt -push A -times -o masked_distance.img. 319 """ 320 set_: str 321 """-as: Assign image at the end of the stack to a variable 322 323 Syntax: `-as var` 324 325 Associates the image currently at the end of the stack with variable name 326 'var'. This allows you to retrieve the image later on the command line using 327 the **-push** command. The **-as** and **-push** commands are useful when 328 you need to use a certain image more than once during a convert3d operation. 329 For example, if you want to compute the distance transform of a binary image 330 and mask it so that the values outside of the binary image region have value 331 0, you would use the following command: 332 333 c3d binary.img -as A -sdt -push A -times -o masked_distance.img""" 334 335 def run( 336 self, 337 execution: Execution, 338 ) -> list[str]: 339 """ 340 Build command line arguments. This method is called by the main command. 341 342 Args: 343 execution: The execution object. 344 Returns: 345 Command line arguments 346 """ 347 cargs = [] 348 cargs.extend([ 349 "-as", 350 self.set_ 351 ]) 352 return cargs 353 354 355@dataclasses.dataclass 356class C3dAsin: 357 """ 358 No description found. 359 """ 360 asin: str 361 """No description found.""" 362 363 def run( 364 self, 365 execution: Execution, 366 ) -> list[str]: 367 """ 368 Build command line arguments. This method is called by the main command. 369 370 Args: 371 execution: The execution object. 372 Returns: 373 Command line arguments 374 """ 375 cargs = [] 376 cargs.extend([ 377 "-asin", 378 self.asin 379 ]) 380 return cargs 381 382 383@dataclasses.dataclass 384class C3dAtan2: 385 """ 386 -atan2: Voxelwise angle from sine and cosine 387 388 Syntax: `-atan2` 389 390 Computes the angle in radians from images containing sine and cosine. This 391 is a voxel-wise operation. It requires two images on the stack (sine 392 followed by cosine): 393 394 c3d sin_theta.nii.gz cos_theta.nii.gz -atan2 -o theta.nii.gz. 395 """ 396 atan2: str 397 """-atan2: Voxelwise angle from sine and cosine 398 399 Syntax: `-atan2` 400 401 Computes the angle in radians from images containing sine and cosine. This 402 is a voxel-wise operation. It requires two images on the stack (sine 403 followed by cosine): 404 405 c3d sin_theta.nii.gz cos_theta.nii.gz -atan2 -o theta.nii.gz""" 406 407 def run( 408 self, 409 execution: Execution, 410 ) -> list[str]: 411 """ 412 Build command line arguments. This method is called by the main command. 413 414 Args: 415 execution: The execution object. 416 Returns: 417 Command line arguments 418 """ 419 cargs = [] 420 cargs.extend([ 421 "-atan2", 422 self.atan2 423 ]) 424 return cargs 425 426 427@dataclasses.dataclass 428class C3dBackground: 429 """ 430 -background: Specify background intensity 431 432 Syntax: `-background <value> ` 433 434 Sets the background intensity for interpolation and other operations where 435 some default background value is needed. Default is 0. 436 """ 437 background: str 438 """-background: Specify background intensity 439 440 Syntax: `-background <value> ` 441 442 Sets the background intensity for interpolation and other operations where 443 some default background value is needed. Default is 0.""" 444 445 def run( 446 self, 447 execution: Execution, 448 ) -> list[str]: 449 """ 450 Build command line arguments. This method is called by the main command. 451 452 Args: 453 execution: The execution object. 454 Returns: 455 Command line arguments 456 """ 457 cargs = [] 458 cargs.extend([ 459 "-background", 460 self.background 461 ]) 462 return cargs 463 464 465@dataclasses.dataclass 466class C3dN4BiasCorrection: 467 """ 468 -biascorr: Automatic MRI bias field correction 469 470 Syntax: `-biascorr` 471 472 Performs automatic bias field correction for MRI images. This feature uses 473 the [N3 implementation in ITK by Dr. Tustison][4], based on the N3 algorithm 474 by Sled et al. 475 476 c3d mri.nii.gz -biascorr -o mricorr.nii.gz. 477 """ 478 n4_bias_correction: str 479 """-biascorr: Automatic MRI bias field correction 480 481 Syntax: `-biascorr` 482 483 Performs automatic bias field correction for MRI images. This feature uses 484 the [N3 implementation in ITK by Dr. Tustison][4], based on the N3 algorithm 485 by Sled et al. 486 487 c3d mri.nii.gz -biascorr -o mricorr.nii.gz""" 488 489 def run( 490 self, 491 execution: Execution, 492 ) -> list[str]: 493 """ 494 Build command line arguments. This method is called by the main command. 495 496 Args: 497 execution: The execution object. 498 Returns: 499 Command line arguments 500 """ 501 cargs = [] 502 cargs.extend([ 503 "-biascorr", 504 self.n4_bias_correction 505 ]) 506 return cargs 507 508 509@dataclasses.dataclass 510class C3dBinarize: 511 """ 512 -binarize: Convert image to binary 513 514 Syntax: `-binarize` 515 516 Converts an image to binary by mapping all background values (the background 517 is 0 by default and can be changed by the option **-background**) to 0 and 518 all non-background values to 1. The **-binarize** command is shorthand for 519 the **-threshold** command. 520 521 c3d test.img -binarize -o binary.img 522 c3d -background 10 -binarize -o binary.img 523 c3d test.img -threshold 10 10 0 1 // equivalent to above command. 524 """ 525 binarize: str 526 """-binarize: Convert image to binary 527 528 Syntax: `-binarize` 529 530 Converts an image to binary by mapping all background values (the background 531 is 0 by default and can be changed by the option **-background**) to 0 and 532 all non-background values to 1. The **-binarize** command is shorthand for 533 the **-threshold** command. 534 535 c3d test.img -binarize -o binary.img 536 c3d -background 10 -binarize -o binary.img 537 c3d test.img -threshold 10 10 0 1 // equivalent to above command""" 538 539 def run( 540 self, 541 execution: Execution, 542 ) -> list[str]: 543 """ 544 Build command line arguments. This method is called by the main command. 545 546 Args: 547 execution: The execution object. 548 Returns: 549 Command line arguments 550 """ 551 cargs = [] 552 cargs.extend([ 553 "-binarize", 554 self.binarize 555 ]) 556 return cargs 557 558 559@dataclasses.dataclass 560class C3dCanny: 561 """ 562 -canny: Canny edge detector 563 564 Syntax: `-canny <sigma_vector> <t_lower> <t_upper>` 565 566 Performs edge detection on the last image on the stack using the Canny 567 filter. The parameters are a vector of standard deviations defining the 568 scale of the edges detected and lower and upper thresholds for edge 569 selection. See documentation on the [ITK Canny Filter][14]. 570 """ 571 canny: str 572 """-canny: Canny edge detector 573 574 Syntax: `-canny <sigma_vector> <t_lower> <t_upper>` 575 576 Performs edge detection on the last image on the stack using the Canny 577 filter. The parameters are a vector of standard deviations defining the 578 scale of the edges detected and lower and upper thresholds for edge 579 selection. See documentation on the [ITK Canny Filter][14].""" 580 581 def run( 582 self, 583 execution: Execution, 584 ) -> list[str]: 585 """ 586 Build command line arguments. This method is called by the main command. 587 588 Args: 589 execution: The execution object. 590 Returns: 591 Command line arguments 592 """ 593 cargs = [] 594 cargs.extend([ 595 "-canny", 596 self.canny 597 ]) 598 return cargs 599 600 601@dataclasses.dataclass 602class C3dCeil: 603 """ 604 -ceil: Round up image intensities 605 606 Syntax: `-ceil ` 607 608 Each image intensity is replaced by the smallest integer larger or equal to 609 it 610 611 c3d input.img -ceil -o output.img. 612 """ 613 ceil: str 614 """-ceil: Round up image intensities 615 616 Syntax: `-ceil ` 617 618 Each image intensity is replaced by the smallest integer larger or equal to 619 it 620 621 c3d input.img -ceil -o output.img""" 622 623 def run( 624 self, 625 execution: Execution, 626 ) -> list[str]: 627 """ 628 Build command line arguments. This method is called by the main command. 629 630 Args: 631 execution: The execution object. 632 Returns: 633 Command line arguments 634 """ 635 cargs = [] 636 cargs.extend([ 637 "-ceil", 638 self.ceil 639 ]) 640 return cargs 641 642 643@dataclasses.dataclass 644class C3dCentroid: 645 """ 646 -centroid: Report centroid of foreground voxels 647 648 Syntax: `-centroid` 649 650 Reports the centroid, in physical coordinates, of all foreground voxels in 651 the image. 652 653 c3d binaryimage.img -centroid // centroid of all non-0 voxels 654 c3d grayimage.img -thresh 1000 7000 1 0 -centroid 1 // centroid of all 655 voxels in range 1000-7000 656 c3d labelimage.img -thresh 5 5 1 0 -centroid // centroid of all voxels with 657 label 5 658 c3d labelimage.img -split -foreach -centroid -endfor // centroids of all 659 labels (including 0). 660 """ 661 centroid: str 662 """-centroid: Report centroid of foreground voxels 663 664 Syntax: `-centroid` 665 666 Reports the centroid, in physical coordinates, of all foreground voxels in 667 the image. 668 669 c3d binaryimage.img -centroid // centroid of all non-0 voxels 670 c3d grayimage.img -thresh 1000 7000 1 0 -centroid 1 // centroid of all 671 voxels in range 1000-7000 672 c3d labelimage.img -thresh 5 5 1 0 -centroid // centroid of all voxels with 673 label 5 674 c3d labelimage.img -split -foreach -centroid -endfor // centroids of all 675 labels (including 0)""" 676 677 def run( 678 self, 679 execution: Execution, 680 ) -> list[str]: 681 """ 682 Build command line arguments. This method is called by the main command. 683 684 Args: 685 execution: The execution object. 686 Returns: 687 Command line arguments 688 """ 689 cargs = [] 690 cargs.extend([ 691 "-centroid", 692 self.centroid 693 ]) 694 return cargs 695 696 697@dataclasses.dataclass 698class C3dCentroidMark: 699 """ 700 -centroid-mark: Mark the centroid of foreground voxels 701 702 Syntax: `-centroid-mark <label>` 703 704 Marks the centroid of the foreground voxels in an image. Unlike 705 **-centroid**, this command does not print the centroid location, but marks 706 the closest voxel in the image with the intensity **label**. The remaining 707 voxels are assigned 0 intensity. Combined with -dilate, this can be used to 708 mark centers of regions with spheres. 709 710 c3d binaryimage.nii -centroid-mark -dilate 1 3x3x3 711 c3d labelimage.nii -split -foreach -centroid-mark -endfor -merge -o 712 centers.nii. 713 """ 714 centroid_mark: str 715 """-centroid-mark: Mark the centroid of foreground voxels 716 717 Syntax: `-centroid-mark <label>` 718 719 Marks the centroid of the foreground voxels in an image. Unlike 720 **-centroid**, this command does not print the centroid location, but marks 721 the closest voxel in the image with the intensity **label**. The remaining 722 voxels are assigned 0 intensity. Combined with -dilate, this can be used to 723 mark centers of regions with spheres. 724 725 c3d binaryimage.nii -centroid-mark -dilate 1 3x3x3 726 c3d labelimage.nii -split -foreach -centroid-mark -endfor -merge -o 727 centers.nii""" 728 729 def run( 730 self, 731 execution: Execution, 732 ) -> list[str]: 733 """ 734 Build command line arguments. This method is called by the main command. 735 736 Args: 737 execution: The execution object. 738 Returns: 739 Command line arguments 740 """ 741 cargs = [] 742 cargs.extend([ 743 "-centroid-mark", 744 self.centroid_mark 745 ]) 746 return cargs 747 748 749@dataclasses.dataclass 750class C3dConnectedComponents: 751 """ 752 -comp, -connected-components: Compute connected components 753 754 Syntax: `-comp` 755 756 Computes the connected components of a binary image. Each connected 757 component is assigned an integer index. Indices are ordered by the size of 758 the component, so the component assigned index 1 is the largest. The 759 background is assigned index 0. To select the largest connected component, 760 combine the call to **-comp** with a call to **-threshold**. 761 762 c3d binary.img -comp -o comp.img 763 c3d binary.img -comp -threshold 1 1 1 0 -o largest_comp.img. 764 """ 765 connected_components: str 766 """-comp, -connected-components: Compute connected components 767 768 Syntax: `-comp` 769 770 Computes the connected components of a binary image. Each connected 771 component is assigned an integer index. Indices are ordered by the size of 772 the component, so the component assigned index 1 is the largest. The 773 background is assigned index 0. To select the largest connected component, 774 combine the call to **-comp** with a call to **-threshold**. 775 776 c3d binary.img -comp -o comp.img 777 c3d binary.img -comp -threshold 1 1 1 0 -o largest_comp.img""" 778 779 def run( 780 self, 781 execution: Execution, 782 ) -> list[str]: 783 """ 784 Build command line arguments. This method is called by the main command. 785 786 Args: 787 execution: The execution object. 788 Returns: 789 Command line arguments 790 """ 791 cargs = [] 792 cargs.extend([ 793 "-connected-components", 794 self.connected_components 795 ]) 796 return cargs 797 798 799@dataclasses.dataclass 800class C3dClear: 801 """ 802 -clear: Clear the image stack 803 804 Syntax: `-clear` 805 806 Clears the image stack. Images assigned a name with the **-as** command will 807 remain in memory. 808 """ 809 clear_: str 810 """-clear: Clear the image stack 811 812 Syntax: `-clear` 813 814 Clears the image stack. Images assigned a name with the **-as** command will 815 remain in memory.""" 816 817 def run( 818 self, 819 execution: Execution, 820 ) -> list[str]: 821 """ 822 Build command line arguments. This method is called by the main command. 823 824 Args: 825 execution: The execution object. 826 Returns: 827 Command line arguments 828 """ 829 cargs = [] 830 cargs.extend([ 831 "-clear", 832 self.clear_ 833 ]) 834 return cargs 835 836 837@dataclasses.dataclass 838class C3dClip: 839 """ 840 -clip: Clip image intensity to range 841 842 Syntax: `-clip iMin iMax` 843 844 Clips image intensities, so that the values below *iMin* are converted to 845 *iMin* and values greater than *iMax* are converted to *iMax*. This is 846 useful for eliminating hyperintensities in images. Values *iMin* and *iMax* 847 are intensity specifications (see below). 848 849 c3d mri.img -clip 1000 8000 -o mriclip01.img // Clips below and above 850 c3d mri.img -clip -inf 8000 -o mriclip02.img // Clips above only 851 c3d mri.img -clip -inf 95% -o mriclip03.img // Clips at 95th percentile. 852 """ 853 clip: str 854 """-clip: Clip image intensity to range 855 856 Syntax: `-clip iMin iMax` 857 858 Clips image intensities, so that the values below *iMin* are converted to 859 *iMin* and values greater than *iMax* are converted to *iMax*. This is 860 useful for eliminating hyperintensities in images. Values *iMin* and *iMax* 861 are intensity specifications (see below). 862 863 c3d mri.img -clip 1000 8000 -o mriclip01.img // Clips below and above 864 c3d mri.img -clip -inf 8000 -o mriclip02.img // Clips above only 865 c3d mri.img -clip -inf 95% -o mriclip03.img // Clips at 95th percentile""" 866 867 def run( 868 self, 869 execution: Execution, 870 ) -> list[str]: 871 """ 872 Build command line arguments. This method is called by the main command. 873 874 Args: 875 execution: The execution object. 876 Returns: 877 Command line arguments 878 """ 879 cargs = [] 880 cargs.extend([ 881 "-clip", 882 self.clip 883 ]) 884 return cargs 885 886 887@dataclasses.dataclass 888class C3dColorMap: 889 """ 890 -color-map, -colormap: Convert scalar image to RGB using color map 891 892 Syntax: `-color-map <ColormapName> [min max]` 893 894 Converts a scalar image to a color (RGB) image using a specified color map. 895 The output of the command are three images, containing the red, green and 896 blue channels of the RGB image. The mapping uses the range of the input 897 image, e.g., using the **jet** color map, the lowest intensity pixel in the 898 image will be mapped to blue, and the highest intesnity pixel will be mapped 899 to red. The admissible color maps are 900 **hot,cool,spring,summer,autumn,winter,copper,jet,hsv,red,green,blue,grey,overunder**. 901 The command can be used with the -omc command to write RGB images. The 902 example below generates a PNG image from a slice in a scalar image. 903 904 c3d scalar.nii.gz -slice z 50% -flip y -color-map jet -type uchar -omc 905 colorslice.png 906 907 By default the full image intensity range is mapped. The optional **min** 908 and **max** parameters can be used to set the range of the color map. 909 910 c3d scalar.nii.gz -slice z 50% -flip y -color-map jet 0 1 -type uchar -omc 911 colorslice.png. 912 """ 913 color_map: str 914 """-color-map, -colormap: Convert scalar image to RGB using color map 915 916 Syntax: `-color-map <ColormapName> [min max]` 917 918 Converts a scalar image to a color (RGB) image using a specified color map. 919 The output of the command are three images, containing the red, green and 920 blue channels of the RGB image. The mapping uses the range of the input 921 image, e.g., using the **jet** color map, the lowest intensity pixel in the 922 image will be mapped to blue, and the highest intesnity pixel will be mapped 923 to red. The admissible color maps are 924 **hot,cool,spring,summer,autumn,winter,copper,jet,hsv,red,green,blue,grey,overunder**. 925 The command can be used with the -omc command to write RGB images. The 926 example below generates a PNG image from a slice in a scalar image. 927 928 c3d scalar.nii.gz -slice z 50% -flip y -color-map jet -type uchar -omc 929 colorslice.png 930 931 By default the full image intensity range is mapped. The optional **min** 932 and **max** parameters can be used to set the range of the color map. 933 934 c3d scalar.nii.gz -slice z 50% -flip y -color-map jet 0 1 -type uchar -omc 935 colorslice.png""" 936 937 def run( 938 self, 939 execution: Execution, 940 ) -> list[str]: 941 """ 942 Build command line arguments. This method is called by the main command. 943 944 Args: 945 execution: The execution object. 946 Returns: 947 Command line arguments 948 """ 949 cargs = [] 950 cargs.extend([ 951 "-colormap", 952 self.color_map 953 ]) 954 return cargs 955 956 957@dataclasses.dataclass 958class C3dCompress: 959 """ 960 -compress, -no-compress: Enable/disable compression for some image files 961 962 Syntax: `-compress` or `-no-compress` 963 964 Turns on compressing for image file formats that support it. For some file 965 formats, like NIFTI (.nii), compression is enabled automatically when the 966 filename includes the **.gz** extension. For other formats, like MetaImage, 967 you need to specify **-compress** to enable compression. The following two 968 commands save the image as compressed NIFTI and MetaImage files: 969 970 c3d input.nii -o output.nii.gz 971 c3d input.nii -compress -o output.mha. 972 """ 973 compress: str 974 """-compress, -no-compress: Enable/disable compression for some image files 975 976 Syntax: `-compress` or `-no-compress` 977 978 Turns on compressing for image file formats that support it. For some file 979 formats, like NIFTI (.nii), compression is enabled automatically when the 980 filename includes the **.gz** extension. For other formats, like MetaImage, 981 you need to specify **-compress** to enable compression. The following two 982 commands save the image as compressed NIFTI and MetaImage files: 983 984 c3d input.nii -o output.nii.gz 985 c3d input.nii -compress -o output.mha""" 986 987 def run( 988 self, 989 execution: Execution, 990 ) -> list[str]: 991 """ 992 Build command line arguments. This method is called by the main command. 993 994 Args: 995 execution: The execution object. 996 Returns: 997 Command line arguments 998 """ 999 cargs = [] 1000 cargs.extend([ 1001 "-compress", 1002 self.compress 1003 ]) 1004 return cargs 1005 1006 1007@dataclasses.dataclass 1008class C3dNoCompress: 1009 """ 1010 -compress, -no-compress: Enable/disable compression for some image files 1011 1012 Syntax: `-compress` or `-no-compress` 1013 1014 Turns on compressing for image file formats that support it. For some file 1015 formats, like NIFTI (.nii), compression is enabled automatically when the 1016 filename includes the **.gz** extension. For other formats, like MetaImage, 1017 you need to specify **-compress** to enable compression. The following two 1018 commands save the image as compressed NIFTI and MetaImage files: 1019 1020 c3d input.nii -o output.nii.gz 1021 c3d input.nii -compress -o output.mha. 1022 """ 1023 no_compress: str 1024 """-compress, -no-compress: Enable/disable compression for some image files 1025 1026 Syntax: `-compress` or `-no-compress` 1027 1028 Turns on compressing for image file formats that support it. For some file 1029 formats, like NIFTI (.nii), compression is enabled automatically when the 1030 filename includes the **.gz** extension. For other formats, like MetaImage, 1031 you need to specify **-compress** to enable compression. The following two 1032 commands save the image as compressed NIFTI and MetaImage files: 1033 1034 c3d input.nii -o output.nii.gz 1035 c3d input.nii -compress -o output.mha""" 1036 1037 def run( 1038 self, 1039 execution: Execution, 1040 ) -> list[str]: 1041 """ 1042 Build command line arguments. This method is called by the main command. 1043 1044 Args: 1045 execution: The execution object. 1046 Returns: 1047 Command line arguments 1048 """ 1049 cargs = [] 1050 cargs.extend([ 1051 "-no-compress", 1052 self.no_compress 1053 ]) 1054 return cargs 1055 1056 1057@dataclasses.dataclass 1058class C3dConv: 1059 """ 1060 -conv: Convolution 1061 1062 Syntax `-conv` 1063 1064 Performs convolution between the last two images on the stack. The 1065 convolution is performed using the Fourier transform. The result is an image 1066 of the same dimensions as the first image. For more details, see ["FFT Based 1067 Convolution" by Gaetan Lehmann][Lehmann]. 1068 1069 c3d image.nii kernel.nii -conv -o result.nii 1070 1071 1072 [Lehmann]: https://hdl.handle.net/10380/3154. 1073 """ 1074 conv: str 1075 """-conv: Convolution 1076 1077 Syntax `-conv` 1078 1079 Performs convolution between the last two images on the stack. The 1080 convolution is performed using the Fourier transform. The result is an image 1081 of the same dimensions as the first image. For more details, see ["FFT Based 1082 Convolution" by Gaetan Lehmann][Lehmann]. 1083 1084 c3d image.nii kernel.nii -conv -o result.nii 1085 1086 1087 [Lehmann]: https://hdl.handle.net/10380/3154""" 1088 1089 def run( 1090 self, 1091 execution: Execution, 1092 ) -> list[str]: 1093 """ 1094 Build command line arguments. This method is called by the main command. 1095 1096 Args: 1097 execution: The execution object. 1098 Returns: 1099 Command line arguments 1100 """ 1101 cargs = [] 1102 cargs.extend([ 1103 "-conv", 1104 self.conv 1105 ]) 1106 return cargs 1107 1108 1109@dataclasses.dataclass 1110class C3dCoordinateMapVoxel: 1111 """ 1112 -cmv, -coordinate-map-voxel: Generate voxel coordinate maps (voxel units) 1113 1114 Syntax: `-cmv` 1115 1116 For a *N*-dimensional image, replaces the last image on the stack with *N* 1117 images. The *k*-th output image at each voxel contains the $k$-th coordinate 1118 of that voxel, in voxel units. 1119 1120 c3d image.nii -cmv -oo coordmap%d.nii.gz 1121 1122 One can use this command to split a brain segmentation image into a left 1123 hemisphere segmentation and a right hemisphere segmentation (assuming the X 1124 coordinate corresponds to the right-left axis) 1125 1126 c3d seg.nii -as SEG -cmv -pop -pop -thresh 50% inf 1 0 -as MASK \ 1127 -push SEG -times -o seg_left.nii.gz \ 1128 -push MASK -replace 1 0 0 1 \ 1129 -push SEG -times -o seg_right.nii.gz. 1130 """ 1131 coordinate_map_voxel: str 1132 """-cmv, -coordinate-map-voxel: Generate voxel coordinate maps (voxel units) 1133 1134 Syntax: `-cmv` 1135 1136 For a *N*-dimensional image, replaces the last image on the stack with *N* 1137 images. The *k*-th output image at each voxel contains the $k$-th coordinate 1138 of that voxel, in voxel units. 1139 1140 c3d image.nii -cmv -oo coordmap%d.nii.gz 1141 1142 One can use this command to split a brain segmentation image into a left 1143 hemisphere segmentation and a right hemisphere segmentation (assuming the X 1144 coordinate corresponds to the right-left axis) 1145 1146 c3d seg.nii -as SEG -cmv -pop -pop -thresh 50% inf 1 0 -as MASK \ 1147 -push SEG -times -o seg_left.nii.gz \ 1148 -push MASK -replace 1 0 0 1 \ 1149 -push SEG -times -o seg_right.nii.gz""" 1150 1151 def run( 1152 self, 1153 execution: Execution, 1154 ) -> list[str]: 1155 """ 1156 Build command line arguments. This method is called by the main command. 1157 1158 Args: 1159 execution: The execution object. 1160 Returns: 1161 Command line arguments 1162 """ 1163 cargs = [] 1164 cargs.extend([ 1165 "-coordinate-map-voxel", 1166 self.coordinate_map_voxel 1167 ]) 1168 return cargs 1169 1170 1171@dataclasses.dataclass 1172class C3dCoordinateMapPhysical: 1173 """ 1174 -cmp, -coordinate-map-physical: Generate voxel coordinate maps (voxel units) 1175 1176 Syntax: `-cmp` 1177 1178 This command is similar to **-cmv** (**-coordinate-map-voxel**), but the 1179 output will contain the physical coordinates of the voxels, in the NIFTI 1180 (RAS) coordinate frame. 1181 """ 1182 coordinate_map_physical: str 1183 """-cmp, -coordinate-map-physical: Generate voxel coordinate maps (voxel 1184 units) 1185 1186 Syntax: `-cmp` 1187 1188 This command is similar to **-cmv** (**-coordinate-map-voxel**), but the 1189 output will contain the physical coordinates of the voxels, in the NIFTI 1190 (RAS) coordinate frame.""" 1191 1192 def run( 1193 self, 1194 execution: Execution, 1195 ) -> list[str]: 1196 """ 1197 Build command line arguments. This method is called by the main command. 1198 1199 Args: 1200 execution: The execution object. 1201 Returns: 1202 Command line arguments 1203 """ 1204 cargs = [] 1205 cargs.extend([ 1206 "-coordinate-map-physical", 1207 self.coordinate_map_physical 1208 ]) 1209 return cargs 1210 1211 1212@dataclasses.dataclass 1213class C3dCopyTransform: 1214 """ 1215 -copy-transform: Copy header information 1216 1217 Syntax: `-copy-transform` 1218 1219 Copies the image header, specifically the image to physical space transform 1220 (origin, spacing, direction cosines), from the first image (reference) to 1221 the second image (target). This is best done with NIFTI images, which store 1222 this information well. In the example below, *out.nii* will have the same 1223 header as *first.nii* and the same intensities as *second.nii*. 1224 1225 c3d first.nii second.nii -copy-transform -o out.nii. 1226 """ 1227 copy_transform: str 1228 """-copy-transform: Copy header information 1229 1230 Syntax: `-copy-transform` 1231 1232 Copies the image header, specifically the image to physical space transform 1233 (origin, spacing, direction cosines), from the first image (reference) to 1234 the second image (target). This is best done with NIFTI images, which store 1235 this information well. In the example below, *out.nii* will have the same 1236 header as *first.nii* and the same intensities as *second.nii*. 1237 1238 c3d first.nii second.nii -copy-transform -o out.nii""" 1239 1240 def run( 1241 self, 1242 execution: Execution, 1243 ) -> list[str]: 1244 """ 1245 Build command line arguments. This method is called by the main command. 1246 1247 Args: 1248 execution: The execution object. 1249 Returns: 1250 Command line arguments 1251 """ 1252 cargs = [] 1253 cargs.extend([ 1254 "-copy-transform", 1255 self.copy_transform 1256 ]) 1257 return cargs 1258 1259 1260@dataclasses.dataclass 1261class C3dCos: 1262 """ 1263 No description found. 1264 """ 1265 cos: str 1266 """No description found.""" 1267 1268 def run( 1269 self, 1270 execution: Execution, 1271 ) -> list[str]: 1272 """ 1273 Build command line arguments. This method is called by the main command. 1274 1275 Args: 1276 execution: The execution object. 1277 Returns: 1278 Command line arguments 1279 """ 1280 cargs = [] 1281 cargs.extend([ 1282 "-cos", 1283 self.cos 1284 ]) 1285 return cargs 1286 1287 1288@dataclasses.dataclass 1289class C3dCreate: 1290 """ 1291 -create: Generate blank image 1292 1293 Syntax: `-create dimensions voxel_size` 1294 1295 Creates a new blank image with specified dimensions and voxel size, and 1296 places it at the end of the stack. The image is set to the current 1297 background value, which is 0 by default but can be overwritten with the 1298 **-background** command. The origin of the image can be changed with the 1299 **-origin** command. 1300 1301 c3d -create 256x256x160 1x1x1mm -o newimage.img 1302 c3d -background 128 -create 256x256x160 1x1x1mm -origin 128x128x80mm -o 1303 newimage.img. 1304 """ 1305 create: str 1306 """-create: Generate blank image 1307 1308 Syntax: `-create dimensions voxel_size` 1309 1310 Creates a new blank image with specified dimensions and voxel size, and 1311 places it at the end of the stack. The image is set to the current 1312 background value, which is 0 by default but can be overwritten with the 1313 **-background** command. The origin of the image can be changed with the 1314 **-origin** command. 1315 1316 c3d -create 256x256x160 1x1x1mm -o newimage.img 1317 c3d -background 128 -create 256x256x160 1x1x1mm -origin 128x128x80mm -o 1318 newimage.img""" 1319 1320 def run( 1321 self, 1322 execution: Execution, 1323 ) -> list[str]: 1324 """ 1325 Build command line arguments. This method is called by the main command. 1326 1327 Args: 1328 execution: The execution object. 1329 Returns: 1330 Command line arguments 1331 """ 1332 cargs = [] 1333 cargs.extend([ 1334 "-create", 1335 self.create 1336 ]) 1337 return cargs 1338 1339 1340@dataclasses.dataclass 1341class C3dDicomSeriesList: 1342 """ 1343 -dicom-series-list: List image series in a DICOM directory 1344 1345 Syntax: `-dicom-series-list <directory> 1346 1347 Prints out a table of DICOM series ids and corresponding image information 1348 to standard output. 1349 """ 1350 dicom_series_list: str 1351 """-dicom-series-list: List image series in a DICOM directory 1352 1353 Syntax: `-dicom-series-list <directory> 1354 1355 Prints out a table of DICOM series ids and corresponding image information 1356 to standard output.""" 1357 1358 def run( 1359 self, 1360 execution: Execution, 1361 ) -> list[str]: 1362 """ 1363 Build command line arguments. This method is called by the main command. 1364 1365 Args: 1366 execution: The execution object. 1367 Returns: 1368 Command line arguments 1369 """ 1370 cargs = [] 1371 cargs.extend([ 1372 "-dicom-series-list", 1373 self.dicom_series_list 1374 ]) 1375 return cargs 1376 1377 1378@dataclasses.dataclass 1379class C3dDicomSeriesRead: 1380 """ 1381 -dicom-series-read: Read a DICOM image series 1382 1383 Syntax: `-dicom-series-read <directory> <series_id>` 1384 1385 Imports a specific DICOM image series from a directory containing DICOM 1386 files. The **directory** parameter may also point to one of the DICOM files 1387 in the directory. 1388 The **seried_id** is a string identifier for the series that can be obtained 1389 by calling **-dicom-series-list**. 1390 """ 1391 dicom_series_read: str 1392 """-dicom-series-read: Read a DICOM image series 1393 1394 Syntax: `-dicom-series-read <directory> <series_id>` 1395 1396 Imports a specific DICOM image series from a directory containing DICOM 1397 files. The **directory** parameter may also point to one of the DICOM files 1398 in the directory. 1399 The **seried_id** is a string identifier for the series that can be obtained 1400 by calling **-dicom-series-list**""" 1401 1402 def run( 1403 self, 1404 execution: Execution, 1405 ) -> list[str]: 1406 """ 1407 Build command line arguments. This method is called by the main command. 1408 1409 Args: 1410 execution: The execution object. 1411 Returns: 1412 Command line arguments 1413 """ 1414 cargs = [] 1415 cargs.extend([ 1416 "-dicom-series-read", 1417 self.dicom_series_read 1418 ]) 1419 return cargs 1420 1421 1422@dataclasses.dataclass 1423class C3dDilate: 1424 """ 1425 -dilate: Binary dilation 1426 1427 Syntax: `-dilate <label> <radius_vector>` 1428 1429 Applies the dilation [mathematical morphology][5] operation to a binary 1430 image. The first parameter is the intensity value of the object that is to 1431 be dilated. The second is the radius of the dilation structuring element in 1432 3D. 1433 1434 c3d binary.img -dilate 255 3x3x3vox -o newimage.img. 1435 """ 1436 dilate: str 1437 """-dilate: Binary dilation 1438 1439 Syntax: `-dilate <label> <radius_vector>` 1440 1441 Applies the dilation [mathematical morphology][5] operation to a binary 1442 image. The first parameter is the intensity value of the object that is to 1443 be dilated. The second is the radius of the dilation structuring element in 1444 3D. 1445 1446 c3d binary.img -dilate 255 3x3x3vox -o newimage.img""" 1447 1448 def run( 1449 self, 1450 execution: Execution, 1451 ) -> list[str]: 1452 """ 1453 Build command line arguments. This method is called by the main command. 1454 1455 Args: 1456 execution: The execution object. 1457 Returns: 1458 Command line arguments 1459 """ 1460 cargs = [] 1461 cargs.extend([ 1462 "-dilate", 1463 self.dilate 1464 ]) 1465 return cargs 1466 1467 1468@dataclasses.dataclass 1469class C3dDivide: 1470 """ 1471 -divide: Voxelwise image division 1472 1473 Syntax: `-divide` 1474 1475 Divides one image by another. For instance to compute C = A / B, use the 1476 command 1477 1478 c3d A.img B.img -divide -o C.img 1479 1480 Divison may generate infinite and not-a-number (NaN) values if B contains 1481 zeros. You can use **-replace** to get rid of these values 1482 1483 c3d A.img B.img -divide -replace inf 1000 -inf -1000 NaN 0 -o C2.img. 1484 """ 1485 divide: str 1486 """-divide: Voxelwise image division 1487 1488 Syntax: `-divide` 1489 1490 Divides one image by another. For instance to compute C = A / B, use the 1491 command 1492 1493 c3d A.img B.img -divide -o C.img 1494 1495 Divison may generate infinite and not-a-number (NaN) values if B contains 1496 zeros. You can use **-replace** to get rid of these values 1497 1498 c3d A.img B.img -divide -replace inf 1000 -inf -1000 NaN 0 -o C2.img""" 1499 1500 def run( 1501 self, 1502 execution: Execution, 1503 ) -> list[str]: 1504 """ 1505 Build command line arguments. This method is called by the main command. 1506 1507 Args: 1508 execution: The execution object. 1509 Returns: 1510 Command line arguments 1511 """ 1512 cargs = [] 1513 cargs.extend([ 1514 "-divide", 1515 self.divide 1516 ]) 1517 return cargs 1518 1519 1520@dataclasses.dataclass 1521class C3dDuplicate: 1522 """ 1523 -dup: Duplicate the last image on the stack 1524 1525 Syntax: `-dup` 1526 1527 Duplicates the image at the end of the stack. This is equivalent to **-as 1528 var -push var**, but shorter. An example is when you want to pass an image 1529 as both arguments to a binary operator, e.g., computing the square of the 1530 image intensity: 1531 1532 c3d input.img -dup -times -o square.img 1533 1534 ### Commands: Voxelwise Calculations. 1535 """ 1536 duplicate: str 1537 """-dup: Duplicate the last image on the stack 1538 1539 Syntax: `-dup` 1540 1541 Duplicates the image at the end of the stack. This is equivalent to **-as 1542 var -push var**, but shorter. An example is when you want to pass an image 1543 as both arguments to a binary operator, e.g., computing the square of the 1544 image intensity: 1545 1546 c3d input.img -dup -times -o square.img 1547 1548 ### Commands: Voxelwise Calculations""" 1549 1550 def run( 1551 self, 1552 execution: Execution, 1553 ) -> list[str]: 1554 """ 1555 Build command line arguments. This method is called by the main command. 1556 1557 Args: 1558 execution: The execution object. 1559 Returns: 1560 Command line arguments 1561 """ 1562 cargs = [] 1563 cargs.extend([ 1564 "-dup", 1565 self.duplicate 1566 ]) 1567 return cargs 1568 1569 1570@dataclasses.dataclass 1571class C3dEndaccum: 1572 """ 1573 -accum, -endaccum: Accumulate operations over all images 1574 1575 Syntax: `-accum command-list -endaccum` 1576 1577 Apply a binary operation (such as addition or multiplication) to all the 1578 images on the stack in a cumulative fashion. The command(s) will be applied 1579 to the last and second-to-last images on the stack, then to the result of 1580 this operation and the third-to-last image on the stack and so on. Below is 1581 the example of using the command to add multiple images. 1582 1583 c3d image*.nii -accum -add -endaccum -o sum.nii. 1584 """ 1585 endaccum: str 1586 """-accum, -endaccum: Accumulate operations over all images 1587 1588 Syntax: `-accum command-list -endaccum` 1589 1590 Apply a binary operation (such as addition or multiplication) to all the 1591 images on the stack in a cumulative fashion. The command(s) will be applied 1592 to the last and second-to-last images on the stack, then to the result of 1593 this operation and the third-to-last image on the stack and so on. Below is 1594 the example of using the command to add multiple images. 1595 1596 c3d image*.nii -accum -add -endaccum -o sum.nii""" 1597 1598 def run( 1599 self, 1600 execution: Execution, 1601 ) -> list[str]: 1602 """ 1603 Build command line arguments. This method is called by the main command. 1604 1605 Args: 1606 execution: The execution object. 1607 Returns: 1608 Command line arguments 1609 """ 1610 cargs = [] 1611 cargs.extend([ 1612 "-endaccum", 1613 self.endaccum 1614 ]) 1615 return cargs 1616 1617 1618@dataclasses.dataclass 1619class C3dEndfor: 1620 """ 1621 -foreach, -endfor: Loop commands over all images on the stack 1622 1623 Syntax: `-foreach commands-list -endfor` 1624 1625 This command forces the commands between **-foreach** and **-endfor** to be 1626 applied to every image on the stack. The main use of this command is to 1627 automate processing of multiple datasets. For example, 1628 1629 c3d epi*.nii -foreach -smooth 3mm -endfor -oo epism%03d.nii. 1630 """ 1631 endfor: str 1632 """-foreach, -endfor: Loop commands over all images on the stack 1633 1634 Syntax: `-foreach commands-list -endfor` 1635 1636 This command forces the commands between **-foreach** and **-endfor** to be 1637 applied to every image on the stack. The main use of this command is to 1638 automate processing of multiple datasets. For example, 1639 1640 c3d epi*.nii -foreach -smooth 3mm -endfor -oo epism%03d.nii""" 1641 1642 def run( 1643 self, 1644 execution: Execution, 1645 ) -> list[str]: 1646 """ 1647 Build command line arguments. This method is called by the main command. 1648 1649 Args: 1650 execution: The execution object. 1651 Returns: 1652 Command line arguments 1653 """ 1654 cargs = [] 1655 cargs.extend([ 1656 "-endfor", 1657 self.endfor 1658 ]) 1659 return cargs 1660 1661 1662@dataclasses.dataclass 1663class C3dErode: 1664 """ 1665 -erode: Binary erosion 1666 1667 Syntax: `-erode <label> <radius_vector>` 1668 1669 Applies erosion [mathematical morphology][5] operation to a binary image. 1670 The first parameter is the intensity value of the object that is to be 1671 eroded. The second is the radius of the erosion structuring element in 3D. 1672 1673 c3d binary.img -erode 255 3x3x3vox -o newimage.img. 1674 """ 1675 erode: str 1676 """-erode: Binary erosion 1677 1678 Syntax: `-erode <label> <radius_vector>` 1679 1680 Applies erosion [mathematical morphology][5] operation to a binary image. 1681 The first parameter is the intensity value of the object that is to be 1682 eroded. The second is the radius of the erosion structuring element in 3D. 1683 1684 c3d binary.img -erode 255 3x3x3vox -o newimage.img""" 1685 1686 def run( 1687 self, 1688 execution: Execution, 1689 ) -> list[str]: 1690 """ 1691 Build command line arguments. This method is called by the main command. 1692 1693 Args: 1694 execution: The execution object. 1695 Returns: 1696 Command line arguments 1697 """ 1698 cargs = [] 1699 cargs.extend([ 1700 "-erode", 1701 self.erode 1702 ]) 1703 return cargs 1704 1705 1706@dataclasses.dataclass 1707class C3dErf: 1708 """ 1709 -erf: Standard error function 1710 1711 Syntax: `-erf mu sigma` 1712 1713 Computes the standard error function. This is useful for applying soft 1714 thresholds. The function computes y = erf((x - mu)/sigma). 1715 1716 c3d input.img -erf 5 2 -o erf.img. 1717 """ 1718 erf: str 1719 """-erf: Standard error function 1720 1721 Syntax: `-erf mu sigma` 1722 1723 Computes the standard error function. This is useful for applying soft 1724 thresholds. The function computes y = erf((x - mu)/sigma). 1725 1726 c3d input.img -erf 5 2 -o erf.img""" 1727 1728 def run( 1729 self, 1730 execution: Execution, 1731 ) -> list[str]: 1732 """ 1733 Build command line arguments. This method is called by the main command. 1734 1735 Args: 1736 execution: The execution object. 1737 Returns: 1738 Command line arguments 1739 """ 1740 cargs = [] 1741 cargs.extend([ 1742 "-erf", 1743 self.erf 1744 ]) 1745 return cargs 1746 1747 1748@dataclasses.dataclass 1749class C3dExp: 1750 """ 1751 -exp: Voxelwise natural exponent 1752 1753 Syntax: `-exp` 1754 1755 Computes exponent of each voxel in the last image on the stack. 1756 1757 c3d input.img -exp -o output.img. 1758 """ 1759 exp: str 1760 """-exp: Voxelwise natural exponent 1761 1762 Syntax: `-exp` 1763 1764 Computes exponent of each voxel in the last image on the stack. 1765 1766 c3d input.img -exp -o output.img""" 1767 1768 def run( 1769 self, 1770 execution: Execution, 1771 ) -> list[str]: 1772 """ 1773 Build command line arguments. This method is called by the main command. 1774 1775 Args: 1776 execution: The execution object. 1777 Returns: 1778 Command line arguments 1779 """ 1780 cargs = [] 1781 cargs.extend([ 1782 "-exp", 1783 self.exp 1784 ]) 1785 return cargs 1786 1787 1788@dataclasses.dataclass 1789class C3dExportPatches: 1790 """ 1791 -export-patches, -xp: Fixed size patch sampling from masked regions 1792 1793 Syntax: `-export-patches <outfile> <radius_vector> <frequency>` 1794 1795 See also: **-export-patches-aug (-xpa)** command, which provides data 1796 augmentation for deep learning. 1797 1798 This command samples patches from a region of a ND image and stores them 1799 into a data file that can be read easily in other software, for example, 1800 NumPy. This is useful for generating training data for machine learning 1801 projects. Multiple "channels" can be sampled. 1802 1803 c3d chan1.nii chan2.nii chan3.nii mask.nii -xp samples.dat 4x4x4 100 1804 1805 This command will sample the three images chan1, chan2, chan3 at foreground 1806 voxels in the mask. Voxels in the mask foreground region are sampled 1807 randomly, following a uniform distribution. The value of 100 means that 1808 every 100-th voxel, on average, is sampled. The radius 4x4x4 means that 1809 patches of size 9x9x9 will be generated. For each sampled voxel, the sampled 1810 intensity data is represented as a 3x9x9x9 array in this example. 1811 1812 To read these samples in NumPy use the following code 1813 1814 dims = (9,9,9) # Patch dimensions 1815 k = 3 # Number of channels 1816 bps = (4 * k * reduce(mul, dims, 1)) # Bytes per sample 1817 np = os.path.getsize(fname) // bps # Number of samples 1818 arr = numpy.memmap(fname,'float32','r',shape=(np,k) + dims) 1819 1820 It is also possible to visualize the extracted samples in ITK-SNAP by 1821 reading them as a raw image, with dimensions equal to the dimensions of the 1822 patch, and the z-dimension multiplied by the number of samples. 1823 1824 The command can also be used to extract entire structures. For example, if 1825 we have a binary segmentation of a lesion of an approximately known size in 1826 an MRI scan, we can extract a patch of given size centered on this lesion, 1827 as follows: 1828 1829 c3d mri.nii lesion_seg.nii -centroid-mark 1 -xp single_sample.dat 50x50x20 1 1830 1831 In the above example, **-centroid-mark** transforms the lesion segmentation 1832 into a single-voxel mask, from which the sample from the MRI is taken. 1833 """ 1834 export_patches: str 1835 """-export-patches, -xp: Fixed size patch sampling from masked regions 1836 1837 Syntax: `-export-patches <outfile> <radius_vector> <frequency>` 1838 1839 See also: **-export-patches-aug (-xpa)** command, which provides data 1840 augmentation for deep learning. 1841 1842 This command samples patches from a region of a ND image and stores them 1843 into a data file that can be read easily in other software, for example, 1844 NumPy. This is useful for generating training data for machine learning 1845 projects. Multiple "channels" can be sampled. 1846 1847 c3d chan1.nii chan2.nii chan3.nii mask.nii -xp samples.dat 4x4x4 100 1848 1849 This command will sample the three images chan1, chan2, chan3 at foreground 1850 voxels in the mask. Voxels in the mask foreground region are sampled 1851 randomly, following a uniform distribution. The value of 100 means that 1852 every 100-th voxel, on average, is sampled. The radius 4x4x4 means that 1853 patches of size 9x9x9 will be generated. For each sampled voxel, the sampled 1854 intensity data is represented as a 3x9x9x9 array in this example. 1855 1856 To read these samples in NumPy use the following code 1857 1858 dims = (9,9,9) # Patch dimensions 1859 k = 3 # Number of channels 1860 bps = (4 * k * reduce(mul, dims, 1)) # Bytes per sample 1861 np = os.path.getsize(fname) // bps # Number of samples 1862 arr = numpy.memmap(fname,'float32','r',shape=(np,k) + dims) 1863 1864 It is also possible to visualize the extracted samples in ITK-SNAP by 1865 reading them as a raw image, with dimensions equal to the dimensions of the 1866 patch, and the z-dimension multiplied by the number of samples. 1867 1868 The command can also be used to extract entire structures. For example, if 1869 we have a binary segmentation of a lesion of an approximately known size in 1870 an MRI scan, we can extract a patch of given size centered on this lesion, 1871 as follows: 1872 1873 c3d mri.nii lesion_seg.nii -centroid-mark 1 -xp single_sample.dat 50x50x20 1 1874 1875 In the above example, **-centroid-mark** transforms the lesion segmentation 1876 into a single-voxel mask, from which the sample from the MRI is taken.""" 1877 1878 def run( 1879 self, 1880 execution: Execution, 1881 ) -> list[str]: 1882 """ 1883 Build command line arguments. This method is called by the main command. 1884 1885 Args: 1886 execution: The execution object. 1887 Returns: 1888 Command line arguments 1889 """ 1890 cargs = [] 1891 cargs.extend([ 1892 "-export-patches", 1893 self.export_patches 1894 ]) 1895 return cargs 1896 1897 1898@dataclasses.dataclass 1899class C3dExportPatchesAug: 1900 """ 1901 -export-patches-aug, -xpa: data augmentation for deep learning 1902 1903 Syntax `-export-patches-aug <N> <sigma_angle>` 1904 1905 This command must precede the `-export-patches (-xp)` command and instructs 1906 this command to not only sample patches along the image axes but to also 1907 sample **N** randomly rotated patches. Rotation is around a uniformly 1908 distributed axis with a rotation angle distributed normally with teh 1909 standard deviation **sigma_angle**, specified in degrees. This kind of 1910 sampling is useful for data augmentation for machine learning algorithms. 1911 1912 c3d chan1.nii chan2.nii chan3.nii mask.nii -xpa 5 10 -xp samples.dat 4x4x4 1913 100. 1914 """ 1915 export_patches_aug: str 1916 """-export-patches-aug, -xpa: data augmentation for deep learning 1917 1918 Syntax `-export-patches-aug <N> <sigma_angle>` 1919 1920 This command must precede the `-export-patches (-xp)` command and instructs 1921 this command to not only sample patches along the image axes but to also 1922 sample **N** randomly rotated patches. Rotation is around a uniformly 1923 distributed axis with a rotation angle distributed normally with teh 1924 standard deviation **sigma_angle**, specified in degrees. This kind of 1925 sampling is useful for data augmentation for machine learning algorithms. 1926 1927 c3d chan1.nii chan2.nii chan3.nii mask.nii -xpa 5 10 -xp samples.dat 4x4x4 1928 100""" 1929 1930 def run( 1931 self, 1932 execution: Execution, 1933 ) -> list[str]: 1934 """ 1935 Build command line arguments. This method is called by the main command. 1936 1937 Args: 1938 execution: The execution object. 1939 Returns: 1940 Command line arguments 1941 """ 1942 cargs = [] 1943 cargs.extend([ 1944 "-export-patches-aug", 1945 self.export_patches_aug 1946 ]) 1947 return cargs 1948 1949 1950@dataclasses.dataclass 1951class C3dExtrudeSeg: 1952 """ 1953 No description found. 1954 """ 1955 extrude_seg: str 1956 """No description found.""" 1957 1958 def run( 1959 self, 1960 execution: Execution, 1961 ) -> list[str]: 1962 """ 1963 Build command line arguments. This method is called by the main command. 1964 1965 Args: 1966 execution: The execution object. 1967 Returns: 1968 Command line arguments 1969 """ 1970 cargs = [] 1971 cargs.extend([ 1972 "-extrude-seg", 1973 self.extrude_seg 1974 ]) 1975 return cargs 1976 1977 1978@dataclasses.dataclass 1979class C3dFillBackgroundWithNoise: 1980 """ 1981 No description found. 1982 """ 1983 fill_background_with_noise: str 1984 """No description found.""" 1985 1986 def run( 1987 self, 1988 execution: Execution, 1989 ) -> list[str]: 1990 """ 1991 Build command line arguments. This method is called by the main command. 1992 1993 Args: 1994 execution: The execution object. 1995 Returns: 1996 Command line arguments 1997 """ 1998 cargs = [] 1999 cargs.extend([ 2000 "-fill-background-with-noise", 2001 self.fill_background_with_noise 2002 ]) 2003 return cargs 2004 2005 2006@dataclasses.dataclass 2007class C3dFft: 2008 """ 2009 -fft: Fast Fourier transform 2010 2011 Syntax `-fft` 2012 2013 Computes the Fourier transform of a real-valued image at the end of the 2014 stack. The image is replaced by the real and imaginary components of the 2015 FFT. This command is only available if **convert3d** is compiled with the 2016 FFTW library support. 2017 2018 c3d image.nii -fft -oo real.nii imag.nii. 2019 """ 2020 fft: str 2021 """-fft: Fast Fourier transform 2022 2023 Syntax `-fft` 2024 2025 Computes the Fourier transform of a real-valued image at the end of the 2026 stack. The image is replaced by the real and imaginary components of the 2027 FFT. This command is only available if **convert3d** is compiled with the 2028 FFTW library support. 2029 2030 c3d image.nii -fft -oo real.nii imag.nii""" 2031 2032 def run( 2033 self, 2034 execution: Execution, 2035 ) -> list[str]: 2036 """ 2037 Build command line arguments. This method is called by the main command. 2038 2039 Args: 2040 execution: The execution object. 2041 Returns: 2042 Command line arguments 2043 """ 2044 cargs = [] 2045 cargs.extend([ 2046 "-fft", 2047 self.fft 2048 ]) 2049 return cargs 2050 2051 2052@dataclasses.dataclass 2053class C3dFlip: 2054 """ 2055 -flip: Flip image around an axis 2056 2057 Syntax: `-flip axes` 2058 2059 Flips the image around specified axes. The parameter 'axes' may be any 2060 combination of characters 'x', 'y', and 'z'; the order does not matter. 2061 2062 c3d input.img -flip xy -o output.img. 2063 """ 2064 flip: str 2065 """-flip: Flip image around an axis 2066 2067 Syntax: `-flip axes` 2068 2069 Flips the image around specified axes. The parameter 'axes' may be any 2070 combination of characters 'x', 'y', and 'z'; the order does not matter. 2071 2072 c3d input.img -flip xy -o output.img""" 2073 2074 def run( 2075 self, 2076 execution: Execution, 2077 ) -> list[str]: 2078 """ 2079 Build command line arguments. This method is called by the main command. 2080 2081 Args: 2082 execution: The execution object. 2083 Returns: 2084 Command line arguments 2085 """ 2086 cargs = [] 2087 cargs.extend([ 2088 "-flip", 2089 self.flip 2090 ]) 2091 return cargs 2092 2093 2094@dataclasses.dataclass 2095class C3dFloor: 2096 """ 2097 -floor: Round down image intensities 2098 2099 Syntax: `-floor ` 2100 2101 Each image intensity is replaced by the largest integer smaller or equal to 2102 it. 2103 2104 c3d input.img -floor -o output.img 2105 2106 To round each intensity to the closest integer, use 2107 2108 c3d input.img -shift 0.5 -floor. 2109 """ 2110 floor: str 2111 """-floor: Round down image intensities 2112 2113 Syntax: `-floor ` 2114 2115 Each image intensity is replaced by the largest integer smaller or equal to 2116 it. 2117 2118 c3d input.img -floor -o output.img 2119 2120 To round each intensity to the closest integer, use 2121 2122 c3d input.img -shift 0.5 -floor""" 2123 2124 def run( 2125 self, 2126 execution: Execution, 2127 ) -> list[str]: 2128 """ 2129 Build command line arguments. This method is called by the main command. 2130 2131 Args: 2132 execution: The execution object. 2133 Returns: 2134 Command line arguments 2135 """ 2136 cargs = [] 2137 cargs.extend([ 2138 "-floor", 2139 self.floor 2140 ]) 2141 return cargs 2142 2143 2144@dataclasses.dataclass 2145class C3dForeach: 2146 """ 2147 -foreach, -endfor: Loop commands over all images on the stack 2148 2149 Syntax: `-foreach commands-list -endfor` 2150 2151 This command forces the commands between **-foreach** and **-endfor** to be 2152 applied to every image on the stack. The main use of this command is to 2153 automate processing of multiple datasets. For example, 2154 2155 c3d epi*.nii -foreach -smooth 3mm -endfor -oo epism%03d.nii. 2156 """ 2157 foreach: str 2158 """-foreach, -endfor: Loop commands over all images on the stack 2159 2160 Syntax: `-foreach commands-list -endfor` 2161 2162 This command forces the commands between **-foreach** and **-endfor** to be 2163 applied to every image on the stack. The main use of this command is to 2164 automate processing of multiple datasets. For example, 2165 2166 c3d epi*.nii -foreach -smooth 3mm -endfor -oo epism%03d.nii""" 2167 2168 def run( 2169 self, 2170 execution: Execution, 2171 ) -> list[str]: 2172 """ 2173 Build command line arguments. This method is called by the main command. 2174 2175 Args: 2176 execution: The execution object. 2177 Returns: 2178 Command line arguments 2179 """ 2180 cargs = [] 2181 cargs.extend([ 2182 "-foreach", 2183 self.foreach 2184 ]) 2185 return cargs 2186 2187 2188@dataclasses.dataclass 2189class C3dForeachComp: 2190 """ 2191 -foreach-comp, -endfor: Loop commands over components of a multi-component 2192 image 2193 2194 Syntax `-foreach-comp <N> commands-list -endfor` 2195 2196 This command runs the list of commands separately for each component of a 2197 set of multi-component images loaded with -mcs. This makes it possible to 2198 perform component-wise operations on multi-component images. For example, it 2199 can be used to average several multi-component images. If the image stack 2200 contains images *x1* *y1* *z1* *x2* *y2* *z2*, then the operations will be 2201 run on *[x1,x2]*, *[y1,y2]*, *[z1,z2]*. For example, if multi_1.nii to 2202 multi_10.nii are three-component images, then the mean three-component image 2203 is given by 2204 2205 c2d -mcs multi_*.nii -foreach-comp -mean -endfor -omc multi_mean.nii. 2206 """ 2207 foreach_comp: str 2208 """-foreach-comp, -endfor: Loop commands over components of a 2209 multi-component image 2210 2211 Syntax `-foreach-comp <N> commands-list -endfor` 2212 2213 This command runs the list of commands separately for each component of a 2214 set of multi-component images loaded with -mcs. This makes it possible to 2215 perform component-wise operations on multi-component images. For example, it 2216 can be used to average several multi-component images. If the image stack 2217 contains images *x1* *y1* *z1* *x2* *y2* *z2*, then the operations will be 2218 run on *[x1,x2]*, *[y1,y2]*, *[z1,z2]*. For example, if multi_1.nii to 2219 multi_10.nii are three-component images, then the mean three-component image 2220 is given by 2221 2222 c2d -mcs multi_*.nii -foreach-comp -mean -endfor -omc multi_mean.nii""" 2223 2224 def run( 2225 self, 2226 execution: Execution, 2227 ) -> list[str]: 2228 """ 2229 Build command line arguments. This method is called by the main command. 2230 2231 Args: 2232 execution: The execution object. 2233 Returns: 2234 Command line arguments 2235 """ 2236 cargs = [] 2237 cargs.extend([ 2238 "-foreach-comp", 2239 self.foreach_comp 2240 ]) 2241 return cargs 2242 2243 2244@dataclasses.dataclass 2245class C3dGlm: 2246 """ 2247 -glm: General linear model 2248 2249 Syntax: `-glm design_matrix_file contrast_vector_file` 2250 2251 Applies voxel-wise general linear model to a set of images. More precisely, 2252 the general linear model solves the following system: $Y = X \beta + 2253 \epsilon$, where Y are the observations (a list of n images, where each 2254 voxel is treated as an independent observation); X is the $n x k$ design 2255 matrix, where $k$ is the number of factors; $\beta$ is a set of $k$ unknown 2256 images (factors) and $\epsilon$ is the error term. The command will compute 2257 the $\beta$ images and return a weighted sum of them, where the weights are 2258 specified in the contrast vector. The design matrix and the contrast vector 2259 are passed in as files. The file format is just a space-separated list of 2260 numbers. For a good explanation of the general linear model, see [S. Kiebel 2261 and A. Holmes, General Linear Model, in Ashburner, Friston, Holmes eds., 2262 *Human Brain Function, 2nd Edition*][6]. The example below computes the 2263 regression coefficient between a set of longitudinal images and subject's 2264 age: 2265 2266 echo "1 67.00" > design_mat.txt 2267 echo "1 75.00" >> design_mat.txt 2268 echo "1 80.00" >> design_mat.txt 2269 echo "1 83.00" >> design_mat.txt 2270 echo "0 1" >> contrast_vec.txt 2271 c3d time1.img time2.img time3.img time4.img -glm design_mat.txt 2272 contrast_vec.txt -o regress.img. 2273 """ 2274 glm: str 2275 """-glm: General linear model 2276 2277 Syntax: `-glm design_matrix_file contrast_vector_file` 2278 2279 Applies voxel-wise general linear model to a set of images. More precisely, 2280 the general linear model solves the following system: $Y = X \beta + 2281 \epsilon$, where Y are the observations (a list of n images, where each 2282 voxel is treated as an independent observation); X is the $n x k$ design 2283 matrix, where $k$ is the number of factors; $\beta$ is a set of $k$ unknown 2284 images (factors) and $\epsilon$ is the error term. The command will compute 2285 the $\beta$ images and return a weighted sum of them, where the weights are 2286 specified in the contrast vector. The design matrix and the contrast vector 2287 are passed in as files. The file format is just a space-separated list of 2288 numbers. For a good explanation of the general linear model, see [S. Kiebel 2289 and A. Holmes, General Linear Model, in Ashburner, Friston, Holmes eds., 2290 *Human Brain Function, 2nd Edition*][6]. The example below computes the 2291 regression coefficient between a set of longitudinal images and subject's 2292 age: 2293 2294 echo "1 67.00" > design_mat.txt 2295 echo "1 75.00" >> design_mat.txt 2296 echo "1 80.00" >> design_mat.txt 2297 echo "1 83.00" >> design_mat.txt 2298 echo "0 1" >> contrast_vec.txt 2299 c3d time1.img time2.img time3.img time4.img -glm design_mat.txt 2300 contrast_vec.txt -o regress.img""" 2301 2302 def run( 2303 self, 2304 execution: Execution, 2305 ) -> list[str]: 2306 """ 2307 Build command line arguments. This method is called by the main command. 2308 2309 Args: 2310 execution: The execution object. 2311 Returns: 2312 Command line arguments 2313 """ 2314 cargs = [] 2315 cargs.extend([ 2316 "-glm", 2317 self.glm 2318 ]) 2319 return cargs 2320 2321 2322@dataclasses.dataclass 2323class C3dGradient: 2324 """ 2325 -grad, -gradient: Image gradient 2326 2327 Syntax `-grad` 2328 2329 Computes the gradient of the image. Each component of the gradient is placed 2330 on the stack in order (x,y,z). The gradient is computed in physical RAS 2331 coordinates, taking into account image spacing and orientation. In other 2332 words, the gradient is the vector in physical space orthogonal to the 2333 isocontours of the image. No smoothing is performed, so it is a good idea to 2334 smooth the image first before computing the gradient. 2335 2336 c3d myimage.nii -smooth 1.2vox -grad -oo grad_comp_%02d.nii. 2337 """ 2338 gradient: str 2339 """-grad, -gradient: Image gradient 2340 2341 Syntax `-grad` 2342 2343 Computes the gradient of the image. Each component of the gradient is placed 2344 on the stack in order (x,y,z). The gradient is computed in physical RAS 2345 coordinates, taking into account image spacing and orientation. In other 2346 words, the gradient is the vector in physical space orthogonal to the 2347 isocontours of the image. No smoothing is performed, so it is a good idea to 2348 smooth the image first before computing the gradient. 2349 2350 c3d myimage.nii -smooth 1.2vox -grad -oo grad_comp_%02d.nii""" 2351 2352 def run( 2353 self, 2354 execution: Execution, 2355 ) -> list[str]: 2356 """ 2357 Build command line arguments. This method is called by the main command. 2358 2359 Args: 2360 execution: The execution object. 2361 Returns: 2362 Command line arguments 2363 """ 2364 cargs = [] 2365 cargs.extend([ 2366 "-grad", 2367 self.gradient 2368 ]) 2369 return cargs 2370 2371 2372@dataclasses.dataclass 2373class C3dHelp: 2374 """ 2375 -hesseig, -hessian-eigenvalues: Compute eigenvalues of the Hessian matrix 2376 2377 Syntax `-hesseig <scale>` 2378 2379 Computes the Hessian matrix at every pixel of an image and the eigenvalues 2380 of the Hessian. Images of the eigenvalues (sorted by value) are placed on 2381 the stack. These images are useful as texture features. See also the 2382 '''-steig''' command. The scale determines the amount of Gaussian smoothing 2383 applied for computing the partial derivatives in the Hessian, and is in 2384 physical (mm) units. 2385 2386 c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz. 2387 """ 2388 v__help: str 2389 """-hesseig, -hessian-eigenvalues: Compute eigenvalues of the Hessian matrix 2390 2391 Syntax `-hesseig <scale>` 2392 2393 Computes the Hessian matrix at every pixel of an image and the eigenvalues 2394 of the Hessian. Images of the eigenvalues (sorted by value) are placed on 2395 the stack. These images are useful as texture features. See also the 2396 '''-steig''' command. The scale determines the amount of Gaussian smoothing 2397 applied for computing the partial derivatives in the Hessian, and is in 2398 physical (mm) units. 2399 2400 c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz""" 2401 2402 def run( 2403 self, 2404 execution: Execution, 2405 ) -> list[str]: 2406 """ 2407 Build command line arguments. This method is called by the main command. 2408 2409 Args: 2410 execution: The execution object. 2411 Returns: 2412 Command line arguments 2413 """ 2414 cargs = [] 2415 cargs.extend([ 2416 "-h", 2417 self.v__help 2418 ]) 2419 return cargs 2420 2421 2422@dataclasses.dataclass 2423class C3dHolefill: 2424 """ 2425 -holefill: Fill holes in binary image 2426 2427 Syntax: `-holefill intensity_value [0|1] ` 2428 2429 Apply the binary hole filling algorithm to a particular intensity value in 2430 the image. The input image is typically a binary image or a multi-label 2431 segmentation image. Holes (voxels not matching the specified intensity value 2432 that are completely contained by voxels matching this value) are filled. The 2433 second parameter specifies what type of topological connectivity is used to 2434 determine holes. The value 0 uses the default algorithm in ITK (face 2435 connectivity) and 1 uses the full connectivity variant (face, edge and 2436 vertex connectivity). For more details see the [ITK page for this 2437 algorithm][7]. 2438 2439 c3d segmentation.nii.gz -holefill 5 0 -type uchar -o filledlabel5.nii.gz. 2440 """ 2441 holefill: str 2442 """-holefill: Fill holes in binary image 2443 2444 Syntax: `-holefill intensity_value [0|1] ` 2445 2446 Apply the binary hole filling algorithm to a particular intensity value in 2447 the image. The input image is typically a binary image or a multi-label 2448 segmentation image. Holes (voxels not matching the specified intensity value 2449 that are completely contained by voxels matching this value) are filled. The 2450 second parameter specifies what type of topological connectivity is used to 2451 determine holes. The value 0 uses the default algorithm in ITK (face 2452 connectivity) and 1 uses the full connectivity variant (face, edge and 2453 vertex connectivity). For more details see the [ITK page for this 2454 algorithm][7]. 2455 2456 c3d segmentation.nii.gz -holefill 5 0 -type uchar -o filledlabel5.nii.gz""" 2457 2458 def run( 2459 self, 2460 execution: Execution, 2461 ) -> list[str]: 2462 """ 2463 Build command line arguments. This method is called by the main command. 2464 2465 Args: 2466 execution: The execution object. 2467 Returns: 2468 Command line arguments 2469 """ 2470 cargs = [] 2471 cargs.extend([ 2472 "-hf", 2473 self.holefill 2474 ]) 2475 return cargs 2476 2477 2478@dataclasses.dataclass 2479class C3dHessianEigenvalues: 2480 """ 2481 -hesseig, -hessian-eigenvalues: Compute eigenvalues of the Hessian matrix 2482 2483 Syntax `-hesseig <scale>` 2484 2485 Computes the Hessian matrix at every pixel of an image and the eigenvalues 2486 of the Hessian. Images of the eigenvalues (sorted by value) are placed on 2487 the stack. These images are useful as texture features. See also the 2488 '''-steig''' command. The scale determines the amount of Gaussian smoothing 2489 applied for computing the partial derivatives in the Hessian, and is in 2490 physical (mm) units. 2491 2492 c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz. 2493 """ 2494 hessian_eigenvalues: str 2495 """-hesseig, -hessian-eigenvalues: Compute eigenvalues of the Hessian matrix 2496 2497 Syntax `-hesseig <scale>` 2498 2499 Computes the Hessian matrix at every pixel of an image and the eigenvalues 2500 of the Hessian. Images of the eigenvalues (sorted by value) are placed on 2501 the stack. These images are useful as texture features. See also the 2502 '''-steig''' command. The scale determines the amount of Gaussian smoothing 2503 applied for computing the partial derivatives in the Hessian, and is in 2504 physical (mm) units. 2505 2506 c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz""" 2507 2508 def run( 2509 self, 2510 execution: Execution, 2511 ) -> list[str]: 2512 """ 2513 Build command line arguments. This method is called by the main command. 2514 2515 Args: 2516 execution: The execution object. 2517 Returns: 2518 Command line arguments 2519 """ 2520 cargs = [] 2521 cargs.extend([ 2522 "-hesseig", 2523 self.hessian_eigenvalues 2524 ]) 2525 return cargs 2526 2527 2528@dataclasses.dataclass 2529class C3dHessianObjectness: 2530 """ 2531 -hessobj, -hessian-objectness: Hessian objectness filter 2532 2533 Syntax: `-hessobj <dimension> <min_scale> <max_scale>` 2534 2535 Also known as the Frangi vesselness filter, this filter can be used to 2536 highlight tube-like, sheet-like and blob-like objects in the image. For 2537 details, see documentation to the [corresponging ITK class][HTOMIF]. 2538 2539 Parameter `dimension` is an integer that determines the kind of features 2540 that are highlighed. Use 0 for blobs, 1 for tubes, 2 for pancakes, etc. The 2541 min and max scale parameters are floating point values, giving the scale of 2542 the features highlighted, in physical units. Typically, just one scale is 2543 used. 2544 2545 # Detect vessel-like structures at scale 0.5mm 2546 c3d image.nii.gz -hessobj 1 0.5 0.5 2547 2548 [HTOMIF] 2549 http://www.itk.org/Doxygen/html/classitk_1_1HessianToObjectnessMeasureImageFilter.html. 2550 """ 2551 hessian_objectness: str 2552 """-hessobj, -hessian-objectness: Hessian objectness filter 2553 2554 Syntax: `-hessobj <dimension> <min_scale> <max_scale>` 2555 2556 Also known as the Frangi vesselness filter, this filter can be used to 2557 highlight tube-like, sheet-like and blob-like objects in the image. For 2558 details, see documentation to the [corresponging ITK class][HTOMIF]. 2559 2560 Parameter `dimension` is an integer that determines the kind of features 2561 that are highlighed. Use 0 for blobs, 1 for tubes, 2 for pancakes, etc. The 2562 min and max scale parameters are floating point values, giving the scale of 2563 the features highlighted, in physical units. Typically, just one scale is 2564 used. 2565 2566 # Detect vessel-like structures at scale 0.5mm 2567 c3d image.nii.gz -hessobj 1 0.5 0.5 2568 2569 [HTOMIF] 2570 http://www.itk.org/Doxygen/html/classitk_1_1HessianToObjectnessMeasureImageFilter.html""" 2571 2572 def run( 2573 self, 2574 execution: Execution, 2575 ) -> list[str]: 2576 """ 2577 Build command line arguments. This method is called by the main command. 2578 2579 Args: 2580 execution: The execution object. 2581 Returns: 2582 Command line arguments 2583 """ 2584 cargs = [] 2585 cargs.extend([ 2586 "-hessobj", 2587 self.hessian_objectness 2588 ]) 2589 return cargs 2590 2591 2592@dataclasses.dataclass 2593class C3dHistogramMatch: 2594 """ 2595 No description found. 2596 """ 2597 histogram_match: str 2598 """No description found.""" 2599 2600 def run( 2601 self, 2602 execution: Execution, 2603 ) -> list[str]: 2604 """ 2605 Build command line arguments. This method is called by the main command. 2606 2607 Args: 2608 execution: The execution object. 2609 Returns: 2610 Command line arguments 2611 """ 2612 cargs = [] 2613 cargs.extend([ 2614 "-histmatch", 2615 self.histogram_match 2616 ]) 2617 return cargs 2618 2619 2620@dataclasses.dataclass 2621class C3dInfo: 2622 """ 2623 -info: Display brief image information 2624 2625 Syntax: `-info` 2626 2627 Prints brief information about the last image on the stack. Does not affect 2628 the stack. 2629 2630 c3d image.hdr -info 2631 2632 Use with the **-foreach** command to get information on multiple images 2633 2634 c3d images*.nii -foreach -info -endfor. 2635 """ 2636 info: str 2637 """-info: Display brief image information 2638 2639 Syntax: `-info` 2640 2641 Prints brief information about the last image on the stack. Does not affect 2642 the stack. 2643 2644 c3d image.hdr -info 2645 2646 Use with the **-foreach** command to get information on multiple images 2647 2648 c3d images*.nii -foreach -info -endfor""" 2649 2650 def run( 2651 self, 2652 execution: Execution, 2653 ) -> list[str]: 2654 """ 2655 Build command line arguments. This method is called by the main command. 2656 2657 Args: 2658 execution: The execution object. 2659 Returns: 2660 Command line arguments 2661 """ 2662 cargs = [] 2663 cargs.extend([ 2664 "-info", 2665 self.info 2666 ]) 2667 return cargs 2668 2669 2670@dataclasses.dataclass 2671class C3dInfoFull: 2672 """ 2673 -info-full: Display verbose image information 2674 2675 Syntax: `-info-full` 2676 2677 Prints extended information about the last image on the stack, such as the 2678 metadata dictionary. For example, 2679 2680 c3d image.hdr -info-full. 2681 """ 2682 info_full: str 2683 """-info-full: Display verbose image information 2684 2685 Syntax: `-info-full` 2686 2687 Prints extended information about the last image on the stack, such as the 2688 metadata dictionary. For example, 2689 2690 c3d image.hdr -info-full""" 2691 2692 def run( 2693 self, 2694 execution: Execution, 2695 ) -> list[str]: 2696 """ 2697 Build command line arguments. This method is called by the main command. 2698 2699 Args: 2700 execution: The execution object. 2701 Returns: 2702 Command line arguments 2703 """ 2704 cargs = [] 2705 cargs.extend([ 2706 "-info-full", 2707 self.info_full 2708 ]) 2709 return cargs 2710 2711 2712@dataclasses.dataclass 2713class C3dInsert: 2714 """ 2715 -insert: Insert image anywhere in the stack 2716 2717 Syntax: `-insert var pos` 2718 2719 This command is similar to **-push**, but allows you to insert the image 2720 associated with 'var' at any position in the stack, counting from the end. 2721 When 'pos' is 0, the image is placed at the end of the stack (same as 2722 **-push**). When pos is one, the image is placed at the next-to-end 2723 position, and so on. 2724 """ 2725 insert: str 2726 """-insert: Insert image anywhere in the stack 2727 2728 Syntax: `-insert var pos` 2729 2730 This command is similar to **-push**, but allows you to insert the image 2731 associated with 'var' at any position in the stack, counting from the end. 2732 When 'pos' is 0, the image is placed at the end of the stack (same as 2733 **-push**). When pos is one, the image is placed at the next-to-end 2734 position, and so on.""" 2735 2736 def run( 2737 self, 2738 execution: Execution, 2739 ) -> list[str]: 2740 """ 2741 Build command line arguments. This method is called by the main command. 2742 2743 Args: 2744 execution: The execution object. 2745 Returns: 2746 Command line arguments 2747 """ 2748 cargs = [] 2749 cargs.extend([ 2750 "-insert", 2751 self.insert 2752 ]) 2753 return cargs 2754 2755 2756@dataclasses.dataclass 2757class C3dInterpolation: 2758 """ 2759 -interpolation: Set interpolation mode 2760 2761 Syntax: `-interpolation <NearestNeighbor|Linear|Cubic|Sinc|Gaussian> 2762 [param]` 2763 2764 Specifies the interpolation used with **-resample** and other commands. 2765 Default is **Linear**. Gaussian interpolation takes as the parameter the 2766 standard deviation of the Gaussian filter (e.g, 1mm). Gaussian interpolation 2767 is very similar in result to first smoothing an image with a Gaussian filter 2768 and then reslicing it with linear interpolation, but is more accurate and 2769 has less aliasing artifacts. It is also slower, and should only be used with 2770 small sigmas (a few voxels across). 2771 2772 Shorthand 0 can be used for *NearestNeighbor*, 1 for *Linear* and 3 for 2773 *Cubic*. For example: 2774 2775 c3d -int 3 test.nii -resample 200x200x200% -o cubic_supersample.nii. 2776 """ 2777 interpolation: str 2778 """-interpolation: Set interpolation mode 2779 2780 Syntax: `-interpolation <NearestNeighbor|Linear|Cubic|Sinc|Gaussian> 2781 [param]` 2782 2783 Specifies the interpolation used with **-resample** and other commands. 2784 Default is **Linear**. Gaussian interpolation takes as the parameter the 2785 standard deviation of the Gaussian filter (e.g, 1mm). Gaussian interpolation 2786 is very similar in result to first smoothing an image with a Gaussian filter 2787 and then reslicing it with linear interpolation, but is more accurate and 2788 has less aliasing artifacts. It is also slower, and should only be used with 2789 small sigmas (a few voxels across). 2790 2791 Shorthand 0 can be used for *NearestNeighbor*, 1 for *Linear* and 3 for 2792 *Cubic*. For example: 2793 2794 c3d -int 3 test.nii -resample 200x200x200% -o cubic_supersample.nii""" 2795 2796 def run( 2797 self, 2798 execution: Execution, 2799 ) -> list[str]: 2800 """ 2801 Build command line arguments. This method is called by the main command. 2802 2803 Args: 2804 execution: The execution object. 2805 Returns: 2806 Command line arguments 2807 """ 2808 cargs = [] 2809 cargs.extend([ 2810 "-interpolation", 2811 self.interpolation 2812 ]) 2813 return cargs 2814 2815 2816@dataclasses.dataclass 2817class C3dIterations: 2818 """ 2819 No description found. 2820 """ 2821 iterations: str 2822 """No description found.""" 2823 2824 def run( 2825 self, 2826 execution: Execution, 2827 ) -> list[str]: 2828 """ 2829 Build command line arguments. This method is called by the main command. 2830 2831 Args: 2832 execution: The execution object. 2833 Returns: 2834 Command line arguments 2835 """ 2836 cargs = [] 2837 cargs.extend([ 2838 "-iterations", 2839 self.iterations 2840 ]) 2841 return cargs 2842 2843 2844@dataclasses.dataclass 2845class C3dLabelOverlap: 2846 """ 2847 No description found. 2848 """ 2849 label_overlap: str 2850 """No description found.""" 2851 2852 def run( 2853 self, 2854 execution: Execution, 2855 ) -> list[str]: 2856 """ 2857 Build command line arguments. This method is called by the main command. 2858 2859 Args: 2860 execution: The execution object. 2861 Returns: 2862 Command line arguments 2863 """ 2864 cargs = [] 2865 cargs.extend([ 2866 "-label-overlap", 2867 self.label_overlap 2868 ]) 2869 return cargs 2870 2871 2872@dataclasses.dataclass 2873class C3dLabelStatistics: 2874 """ 2875 -lstat, -label-statistics: Display segmentation volumes and intensity 2876 statistics 2877 2878 Syntax: `-lstat` 2879 2880 Given a grayscale image and a multilabel (or binary) image, this command 2881 computes the statistics for every label in the latter, including volumes, 2882 average grayscale intensity, etc. For instance, if image *mri.nii* is a 2883 medical image and *seg.nii* is a multilabel segmentation of the image with 2884 labels 0, 1 and 4, the following command can be used to print the statistics 2885 of the intensity of *mri.nii* for each of the labels 2886 2887 c3d mri.nii seg.nii -lstat 2888 2889 The output contains the mean, standard deviation, maximum intensity and 2890 minimum intensity for each label. If you just need volumes from a 2891 multi-label image, use **-dup** command as follows: 2892 2893 c3d seg.nii -dup -lstat. 2894 """ 2895 label_statistics: str 2896 """-lstat, -label-statistics: Display segmentation volumes and intensity 2897 statistics 2898 2899 Syntax: `-lstat` 2900 2901 Given a grayscale image and a multilabel (or binary) image, this command 2902 computes the statistics for every label in the latter, including volumes, 2903 average grayscale intensity, etc. For instance, if image *mri.nii* is a 2904 medical image and *seg.nii* is a multilabel segmentation of the image with 2905 labels 0, 1 and 4, the following command can be used to print the statistics 2906 of the intensity of *mri.nii* for each of the labels 2907 2908 c3d mri.nii seg.nii -lstat 2909 2910 The output contains the mean, standard deviation, maximum intensity and 2911 minimum intensity for each label. If you just need volumes from a 2912 multi-label image, use **-dup** command as follows: 2913 2914 c3d seg.nii -dup -lstat""" 2915 2916 def run( 2917 self, 2918 execution: Execution, 2919 ) -> list[str]: 2920 """ 2921 Build command line arguments. This method is called by the main command. 2922 2923 Args: 2924 execution: The execution object. 2925 Returns: 2926 Command line arguments 2927 """ 2928 cargs = [] 2929 cargs.extend([ 2930 "-label-statistics", 2931 self.label_statistics 2932 ]) 2933 return cargs 2934 2935 2936@dataclasses.dataclass 2937class C3dLandmarksToSpheres: 2938 """ 2939 No description found. 2940 """ 2941 landmarks_to_spheres: str 2942 """No description found.""" 2943 2944 def run( 2945 self, 2946 execution: Execution, 2947 ) -> list[str]: 2948 """ 2949 Build command line arguments. This method is called by the main command. 2950 2951 Args: 2952 execution: The execution object. 2953 Returns: 2954 Command line arguments 2955 """ 2956 cargs = [] 2957 cargs.extend([ 2958 "-landmarks-to-spheres", 2959 self.landmarks_to_spheres 2960 ]) 2961 return cargs 2962 2963 2964@dataclasses.dataclass 2965class C3dLaplacian: 2966 """ 2967 -laplacian, -laplace: Laplacian filter 2968 2969 Syntax: `-laplacian` 2970 2971 Applies the Laplacian filter to the image. Used to detect ridges of 2972 intensity. Typically, used with the **-smooth** option to obtain the 2973 equivalent of convolving the image with the *Laplacian of the Gaussian 2974 (LoG)* kernel: 2975 2976 c3d input.img -smooth 1.2vox -laplacian -o output.img. 2977 """ 2978 laplacian: str 2979 """-laplacian, -laplace: Laplacian filter 2980 2981 Syntax: `-laplacian` 2982 2983 Applies the Laplacian filter to the image. Used to detect ridges of 2984 intensity. Typically, used with the **-smooth** option to obtain the 2985 equivalent of convolving the image with the *Laplacian of the Gaussian 2986 (LoG)* kernel: 2987 2988 c3d input.img -smooth 1.2vox -laplacian -o output.img""" 2989 2990 def run( 2991 self, 2992 execution: Execution, 2993 ) -> list[str]: 2994 """ 2995 Build command line arguments. This method is called by the main command. 2996 2997 Args: 2998 execution: The execution object. 2999 Returns: 3000 Command line arguments 3001 """ 3002 cargs = [] 3003 cargs.extend([ 3004 "-laplacian", 3005 self.laplacian 3006 ]) 3007 return cargs 3008 3009 3010@dataclasses.dataclass 3011class C3dLevelset: 3012 """ 3013 -levelset: Level set segmentation 3014 3015 Syntax: `-levelset n_iter ` 3016 3017 Perform level set segmentation for *n\_iter* iterations, like in ITK-SNAP. 3018 The last image on the stack is treated as the initialization image and the 3019 next-to-last image on the stack is the speed image. Both images should be in 3020 the range between -1 and 1. Here is how the signs of the different images 3021 are interpreted 3022 3023 | | Speed Image | Initialization Image | Output Image | 3024 | -- | ------------- | -------------------- | ------------ | 3025 | +1 | Foreground | Outside | Outside | 3026 | -1 | Background | Inside | Inside | 3027 3028 Here is an example where you have the speed and the initialization given: 3029 3030 c3d speed.img initial.img -levelset-curvature 0.5 -levelset 100 -o seg.img 3031 3032 Here is an example of segmenting the ventricles in an MRI image, where the 3033 ventricles and other CSF have intensity below 715. The image 3034 seg_bubbles.nii.gz in this example is a binary image of the initialization 3035 seeds (1 inside the seeds, 0 outside). 3036 3037 c3d brain.nii.gz -erf 715 100 -scale -1 seg_bubbles.nii.gz \ 3038 -replace 0 1 1 -1 -levelset-curvature 0.2 -levelset 500 \ 3039 -thresh -inf 0 1 0 -o segmentation.nii.gz 3040 3041 Another example of smoothing a binary image that is useful for cleaning up 3042 manual segmentations. Here the speed image is positive inside the binary 3043 object, and the initialization is negative inside the object. The command 3044 writes out both the level set image (whose 0-level set is the smoothed 3045 boundary of the binary object) and the smoothed binary object 3046 3047 c3d binary.img -threshold 1 inf 1 -1 -binary.img 1 inf 1 -1 \ 3048 -levelset-curvature 1.5 -levelset 100 -o levelset.img \ 3049 -thresh -inf 0 1 0 -o smoothed_binary.img. 3050 """ 3051 levelset: str 3052 """-levelset: Level set segmentation 3053 3054 Syntax: `-levelset n_iter ` 3055 3056 Perform level set segmentation for *n\_iter* iterations, like in ITK-SNAP. 3057 The last image on the stack is treated as the initialization image and the 3058 next-to-last image on the stack is the speed image. Both images should be in 3059 the range between -1 and 1. Here is how the signs of the different images 3060 are interpreted 3061 3062 | | Speed Image | Initialization Image | Output Image | 3063 | -- | ------------- | -------------------- | ------------ | 3064 | +1 | Foreground | Outside | Outside | 3065 | -1 | Background | Inside | Inside | 3066 3067 Here is an example where you have the speed and the initialization given: 3068 3069 c3d speed.img initial.img -levelset-curvature 0.5 -levelset 100 -o seg.img 3070 3071 Here is an example of segmenting the ventricles in an MRI image, where the 3072 ventricles and other CSF have intensity below 715. The image 3073 seg_bubbles.nii.gz in this example is a binary image of the initialization 3074 seeds (1 inside the seeds, 0 outside). 3075 3076 c3d brain.nii.gz -erf 715 100 -scale -1 seg_bubbles.nii.gz \ 3077 -replace 0 1 1 -1 -levelset-curvature 0.2 -levelset 500 \ 3078 -thresh -inf 0 1 0 -o segmentation.nii.gz 3079 3080 Another example of smoothing a binary image that is useful for cleaning up 3081 manual segmentations. Here the speed image is positive inside the binary 3082 object, and the initialization is negative inside the object. The command 3083 writes out both the level set image (whose 0-level set is the smoothed 3084 boundary of the binary object) and the smoothed binary object 3085 3086 c3d binary.img -threshold 1 inf 1 -1 -binary.img 1 inf 1 -1 \ 3087 -levelset-curvature 1.5 -levelset 100 -o levelset.img \ 3088 -thresh -inf 0 1 0 -o smoothed_binary.img""" 3089 3090 def run( 3091 self, 3092 execution: Execution, 3093 ) -> list[str]: 3094 """ 3095 Build command line arguments. This method is called by the main command. 3096 3097 Args: 3098 execution: The execution object. 3099 Returns: 3100 Command line arguments 3101 """ 3102 cargs = [] 3103 cargs.extend([ 3104 "-levelset", 3105 self.levelset 3106 ]) 3107 return cargs 3108 3109 3110@dataclasses.dataclass 3111class C3dLevelsetCurvature: 3112 """ 3113 No description found. 3114 """ 3115 levelset_curvature: str 3116 """No description found.""" 3117 3118 def run( 3119 self, 3120 execution: Execution, 3121 ) -> list[str]: 3122 """ 3123 Build command line arguments. This method is called by the main command. 3124 3125 Args: 3126 execution: The execution object. 3127 Returns: 3128 Command line arguments 3129 """ 3130 cargs = [] 3131 cargs.extend([ 3132 "-levelset-curvature", 3133 self.levelset_curvature 3134 ]) 3135 return cargs 3136 3137 3138@dataclasses.dataclass 3139class C3dLevelsetAdvection: 3140 """ 3141 No description found. 3142 """ 3143 levelset_advection: str 3144 """No description found.""" 3145 3146 def run( 3147 self, 3148 execution: Execution, 3149 ) -> list[str]: 3150 """ 3151 Build command line arguments. This method is called by the main command. 3152 3153 Args: 3154 execution: The execution object. 3155 Returns: 3156 Command line arguments 3157 """ 3158 cargs = [] 3159 cargs.extend([ 3160 "-levelset-advection", 3161 self.levelset_advection 3162 ]) 3163 return cargs 3164 3165 3166@dataclasses.dataclass 3167class C3dLog: 3168 """ 3169 -log, -ln: Voxelwise natural logarithm 3170 3171 Syntax: `-log` 3172 3173 Computes natural logarithm of each voxel in the last image on the stack. 3174 """ 3175 log: str 3176 """-log, -ln: Voxelwise natural logarithm 3177 3178 Syntax: `-log` 3179 3180 Computes natural logarithm of each voxel in the last image on the stack.""" 3181 3182 def run( 3183 self, 3184 execution: Execution, 3185 ) -> list[str]: 3186 """ 3187 Build command line arguments. This method is called by the main command. 3188 3189 Args: 3190 execution: The execution object. 3191 Returns: 3192 Command line arguments 3193 """ 3194 cargs = [] 3195 cargs.extend([ 3196 "-ln", 3197 self.log 3198 ]) 3199 return cargs 3200 3201 3202@dataclasses.dataclass 3203class C3dLog10: 3204 """ 3205 -log10: Voxelwise base 10 logarithm 3206 3207 Syntax: `-log10` 3208 3209 Computes base 10 logarithm of each voxel in the last image on the stack. 3210 """ 3211 log10: str 3212 """-log10: Voxelwise base 10 logarithm 3213 3214 Syntax: `-log10` 3215 3216 Computes base 10 logarithm of each voxel in the last image on the stack.""" 3217 3218 def run( 3219 self, 3220 execution: Execution, 3221 ) -> list[str]: 3222 """ 3223 Build command line arguments. This method is called by the main command. 3224 3225 Args: 3226 execution: The execution object. 3227 Returns: 3228 Command line arguments 3229 """ 3230 cargs = [] 3231 cargs.extend([ 3232 "-log10", 3233 self.log10 3234 ]) 3235 return cargs 3236 3237 3238@dataclasses.dataclass 3239class C3dManual: 3240 """ 3241 No description found. 3242 """ 3243 manual: str 3244 """No description found.""" 3245 3246 def run( 3247 self, 3248 execution: Execution, 3249 ) -> list[str]: 3250 """ 3251 Build command line arguments. This method is called by the main command. 3252 3253 Args: 3254 execution: The execution object. 3255 Returns: 3256 Command line arguments 3257 """ 3258 cargs = [] 3259 cargs.extend([ 3260 "-manual", 3261 self.manual 3262 ]) 3263 return cargs 3264 3265 3266@dataclasses.dataclass 3267class C3dMatchBoundingBox: 3268 """ 3269 -mbb, -match-bounding-box: Match bounding box of one image to another 3270 3271 Syntax: `-mbb` 3272 3273 Given two images on the stack (reference and target), sets the header of the 3274 target image so that the two images occupy the same physical space. The 3275 direction cosines of the target image are set to match the reference image. 3276 This command is related to '-copy-transform' but supports images of 3277 different size. 3278 3279 c3d reference.nii target.nii -mbb -o out.nii. 3280 """ 3281 match_bounding_box: str 3282 """-mbb, -match-bounding-box: Match bounding box of one image to another 3283 3284 Syntax: `-mbb` 3285 3286 Given two images on the stack (reference and target), sets the header of the 3287 target image so that the two images occupy the same physical space. The 3288 direction cosines of the target image are set to match the reference image. 3289 This command is related to '-copy-transform' but supports images of 3290 different size. 3291 3292 c3d reference.nii target.nii -mbb -o out.nii""" 3293 3294 def run( 3295 self, 3296 execution: Execution, 3297 ) -> list[str]: 3298 """ 3299 Build command line arguments. This method is called by the main command. 3300 3301 Args: 3302 execution: The execution object. 3303 Returns: 3304 Command line arguments 3305 """ 3306 cargs = [] 3307 cargs.extend([ 3308 "-match-bounding-box", 3309 self.match_bounding_box 3310 ]) 3311 return cargs 3312 3313 3314@dataclasses.dataclass 3315class C3dMaximum: 3316 """ 3317 -max: Voxel-wise maximum of two images 3318 3319 Syntax: `-max` 3320 3321 Computes the voxel-wise maximum of two images. Can be used with the 3322 **-accum** command to compute maximum of all images. 3323 3324 c3d i1.nii i2.nii -max -o max12.nii 3325 c3d i1.nii i2.nii i3.nii i4.nii -accum -max -endaccum -o max1234.nii. 3326 """ 3327 maximum: str 3328 """-max: Voxel-wise maximum of two images 3329 3330 Syntax: `-max` 3331 3332 Computes the voxel-wise maximum of two images. Can be used with the 3333 **-accum** command to compute maximum of all images. 3334 3335 c3d i1.nii i2.nii -max -o max12.nii 3336 c3d i1.nii i2.nii i3.nii i4.nii -accum -max -endaccum -o max1234.nii""" 3337 3338 def run( 3339 self, 3340 execution: Execution, 3341 ) -> list[str]: 3342 """ 3343 Build command line arguments. This method is called by the main command. 3344 3345 Args: 3346 execution: The execution object. 3347 Returns: 3348 Command line arguments 3349 """ 3350 cargs = [] 3351 cargs.extend([ 3352 "-maximum", 3353 self.maximum 3354 ]) 3355 return cargs 3356 3357 3358@dataclasses.dataclass 3359class C3dMulticomponentSplit: 3360 """ 3361 -mcs, -multicomponent-split: Enable splitting of multi-component images on 3362 read 3363 3364 Syntax: `-mcs` 3365 3366 Enable reading of multi-component images. By default, when a multi-component 3367 image is encountered, the components are combined into a single image. 3368 Setting the **-mcs** flag changes this behavior, and each of the components 3369 is loaded sequentially. See the section below on multi-component image 3370 support. 3371 3372 $ c3d -mcs rgb.mha -foreach -probe 110x110x80mm -endfor 3373 Interpolated image value at 110 110 80 is 1 3374 Interpolated image value at 110 110 80 is 66 3375 Interpolated image value at 110 110 80 is 29 3376 3377 $ c3d rgb.mha -foreach -probe 110x110x80mm -endfor 3378 Interpolated image value at 110 110 80 is 49.5198. 3379 """ 3380 multicomponent_split: str 3381 """-mcs, -multicomponent-split: Enable splitting of multi-component images 3382 on read 3383 3384 Syntax: `-mcs` 3385 3386 Enable reading of multi-component images. By default, when a multi-component 3387 image is encountered, the components are combined into a single image. 3388 Setting the **-mcs** flag changes this behavior, and each of the components 3389 is loaded sequentially. See the section below on multi-component image 3390 support. 3391 3392 $ c3d -mcs rgb.mha -foreach -probe 110x110x80mm -endfor 3393 Interpolated image value at 110 110 80 is 1 3394 Interpolated image value at 110 110 80 is 66 3395 Interpolated image value at 110 110 80 is 29 3396 3397 $ c3d rgb.mha -foreach -probe 110x110x80mm -endfor 3398 Interpolated image value at 110 110 80 is 49.5198""" 3399 3400 def run( 3401 self, 3402 execution: Execution, 3403 ) -> list[str]: 3404 """ 3405 Build command line arguments. This method is called by the main command. 3406 3407 Args: 3408 execution: The execution object. 3409 Returns: 3410 Command line arguments 3411 """ 3412 cargs = [] 3413 cargs.extend([ 3414 "-mcs", 3415 self.multicomponent_split 3416 ]) 3417 return cargs 3418 3419 3420@dataclasses.dataclass 3421class C3dMean: 3422 """ 3423 -mean: Mean of all images on the stack 3424 3425 Syntax: `-mean ` 3426 3427 Computes the mean of all the images on the stack. All images on the stack 3428 are replaced with the mean image. 3429 3430 c3d image_*.nii -mean -o mean.nii. 3431 """ 3432 mean: str 3433 """-mean: Mean of all images on the stack 3434 3435 Syntax: `-mean ` 3436 3437 Computes the mean of all the images on the stack. All images on the stack 3438 are replaced with the mean image. 3439 3440 c3d image_*.nii -mean -o mean.nii""" 3441 3442 def run( 3443 self, 3444 execution: Execution, 3445 ) -> list[str]: 3446 """ 3447 Build command line arguments. This method is called by the main command. 3448 3449 Args: 3450 execution: The execution object. 3451 Returns: 3452 Command line arguments 3453 """ 3454 cargs = [] 3455 cargs.extend([ 3456 "-mean", 3457 self.mean 3458 ]) 3459 return cargs 3460 3461 3462@dataclasses.dataclass 3463class C3dMedianFilter: 3464 """ 3465 -median, -median-filter: Median filter 3466 3467 Syntax: `-median <radius_vector>` 3468 3469 Applies the median filter: the intensity of each voxel is replaced by the 3470 median of the intensities in the neighborhood of size specified by the 3471 radius parameter. For example, the following code will apply the median 3472 filter with the 5x5x5 neighborhood. 3473 3474 c3d in.nii -median 2x2x2 -o median.nii. 3475 """ 3476 median_filter: str 3477 """-median, -median-filter: Median filter 3478 3479 Syntax: `-median <radius_vector>` 3480 3481 Applies the median filter: the intensity of each voxel is replaced by the 3482 median of the intensities in the neighborhood of size specified by the 3483 radius parameter. For example, the following code will apply the median 3484 filter with the 5x5x5 neighborhood. 3485 3486 c3d in.nii -median 2x2x2 -o median.nii""" 3487 3488 def run( 3489 self, 3490 execution: Execution, 3491 ) -> list[str]: 3492 """ 3493 Build command line arguments. This method is called by the main command. 3494 3495 Args: 3496 execution: The execution object. 3497 Returns: 3498 Command line arguments 3499 """ 3500 cargs = [] 3501 cargs.extend([ 3502 "-median", 3503 self.median_filter 3504 ]) 3505 return cargs 3506 3507 3508@dataclasses.dataclass 3509class C3dMerge: 3510 """ 3511 -merge: Merge images from previous split command 3512 3513 Syntax: `-merge` 3514 3515 Works in conjunction with the **-split** command. Has similar behavior to 3516 **-vote**, except that label values are carried from the input to the 3517 **-split** command. 3518 """ 3519 merge: str 3520 """-merge: Merge images from previous split command 3521 3522 Syntax: `-merge` 3523 3524 Works in conjunction with the **-split** command. Has similar behavior to 3525 **-vote**, except that label values are carried from the input to the 3526 **-split** command.""" 3527 3528 def run( 3529 self, 3530 execution: Execution, 3531 ) -> list[str]: 3532 """ 3533 Build command line arguments. This method is called by the main command. 3534 3535 Args: 3536 execution: The execution object. 3537 Returns: 3538 Command line arguments 3539 """ 3540 cargs = [] 3541 cargs.extend([ 3542 "-merge", 3543 self.merge 3544 ]) 3545 return cargs 3546 3547 3548@dataclasses.dataclass 3549class C3dMeanFilter: 3550 """ 3551 -mf, -mean-filter: Mean filter 3552 3553 Syntax: `-mf <radius_vector>` 3554 3555 Applies the mean filter: the intensity of each voxel is replaced by the mean 3556 of the intensities in the neighborhood of size specified by the radius 3557 parameter. For example, the following code will apply the mean filter with 3558 the 5x5x5 neighborhood. 3559 3560 c3d in.nii -mf 2x2x2 -o filtered.nii. 3561 """ 3562 mean_filter: str 3563 """-mf, -mean-filter: Mean filter 3564 3565 Syntax: `-mf <radius_vector>` 3566 3567 Applies the mean filter: the intensity of each voxel is replaced by the mean 3568 of the intensities in the neighborhood of size specified by the radius 3569 parameter. For example, the following code will apply the mean filter with 3570 the 5x5x5 neighborhood. 3571 3572 c3d in.nii -mf 2x2x2 -o filtered.nii""" 3573 3574 def run( 3575 self, 3576 execution: Execution, 3577 ) -> list[str]: 3578 """ 3579 Build command line arguments. This method is called by the main command. 3580 3581 Args: 3582 execution: The execution object. 3583 Returns: 3584 Command line arguments 3585 """ 3586 cargs = [] 3587 cargs.extend([ 3588 "-mf", 3589 self.mean_filter 3590 ]) 3591 return cargs 3592 3593 3594@dataclasses.dataclass 3595class C3dMutualInfo: 3596 """ 3597 -min: Voxel-wise minimum of two images 3598 3599 Syntax: `-min` 3600 3601 Computes the voxel-wise minimum of two images. Can be used with the 3602 **-accum** command to compute minimum of all images. 3603 3604 c3d i1.nii i2.nii -min -o min12.nii 3605 c3d i1.nii i2.nii i3.nii i4.nii -accum -min -endaccum -o min1234.nii. 3606 """ 3607 mutual_info: str 3608 """-min: Voxel-wise minimum of two images 3609 3610 Syntax: `-min` 3611 3612 Computes the voxel-wise minimum of two images. Can be used with the 3613 **-accum** command to compute minimum of all images. 3614 3615 c3d i1.nii i2.nii -min -o min12.nii 3616 c3d i1.nii i2.nii i3.nii i4.nii -accum -min -endaccum -o min1234.nii""" 3617 3618 def run( 3619 self, 3620 execution: Execution, 3621 ) -> list[str]: 3622 """ 3623 Build command line arguments. This method is called by the main command. 3624 3625 Args: 3626 execution: The execution object. 3627 Returns: 3628 Command line arguments 3629 """ 3630 cargs = [] 3631 cargs.extend([ 3632 "-mi", 3633 self.mutual_info 3634 ]) 3635 return cargs 3636 3637 3638@dataclasses.dataclass 3639class C3dMinimum: 3640 """ 3641 -min: Voxel-wise minimum of two images 3642 3643 Syntax: `-min` 3644 3645 Computes the voxel-wise minimum of two images. Can be used with the 3646 **-accum** command to compute minimum of all images. 3647 3648 c3d i1.nii i2.nii -min -o min12.nii 3649 c3d i1.nii i2.nii i3.nii i4.nii -accum -min -endaccum -o min1234.nii. 3650 """ 3651 minimum: str 3652 """-min: Voxel-wise minimum of two images 3653 3654 Syntax: `-min` 3655 3656 Computes the voxel-wise minimum of two images. Can be used with the 3657 **-accum** command to compute minimum of all images. 3658 3659 c3d i1.nii i2.nii -min -o min12.nii 3660 c3d i1.nii i2.nii i3.nii i4.nii -accum -min -endaccum -o min1234.nii""" 3661 3662 def run( 3663 self, 3664 execution: Execution, 3665 ) -> list[str]: 3666 """ 3667 Build command line arguments. This method is called by the main command. 3668 3669 Args: 3670 execution: The execution object. 3671 Returns: 3672 Command line arguments 3673 """ 3674 cargs = [] 3675 cargs.extend([ 3676 "-minimum", 3677 self.minimum 3678 ]) 3679 return cargs 3680 3681 3682@dataclasses.dataclass 3683class C3dMixtureModel: 3684 """ 3685 No description found. 3686 """ 3687 mixture_model: str 3688 """No description found.""" 3689 3690 def run( 3691 self, 3692 execution: Execution, 3693 ) -> list[str]: 3694 """ 3695 Build command line arguments. This method is called by the main command. 3696 3697 Args: 3698 execution: The execution object. 3699 Returns: 3700 Command line arguments 3701 """ 3702 cargs = [] 3703 cargs.extend([ 3704 "-mixture", 3705 self.mixture_model 3706 ]) 3707 return cargs 3708 3709 3710@dataclasses.dataclass 3711class C3dMoments: 3712 """ 3713 No description found. 3714 """ 3715 moments: str 3716 """No description found.""" 3717 3718 def run( 3719 self, 3720 execution: Execution, 3721 ) -> list[str]: 3722 """ 3723 Build command line arguments. This method is called by the main command. 3724 3725 Args: 3726 execution: The execution object. 3727 Returns: 3728 Command line arguments 3729 """ 3730 cargs = [] 3731 cargs.extend([ 3732 "-moments", 3733 self.moments 3734 ]) 3735 return cargs 3736 3737 3738@dataclasses.dataclass 3739class C3dMattesMutualInfo: 3740 """ 3741 No description found. 3742 """ 3743 mattes_mutual_info: str 3744 """No description found.""" 3745 3746 def run( 3747 self, 3748 execution: Execution, 3749 ) -> list[str]: 3750 """ 3751 Build command line arguments. This method is called by the main command. 3752 3753 Args: 3754 execution: The execution object. 3755 Returns: 3756 Command line arguments 3757 """ 3758 cargs = [] 3759 cargs.extend([ 3760 "-mmi", 3761 self.mattes_mutual_info 3762 ]) 3763 return cargs 3764 3765 3766@dataclasses.dataclass 3767class C3dMeanSquare: 3768 """ 3769 -msq, -mean-square: Compute mean square difference metric 3770 3771 Syntax: `-msq [movtransform.mat] [reftransform.mat]` 3772 3773 Compute the mean square difference metric between the last two images on the 3774 stack. If an optional *movtransform.mat* file is provided, the metric is 3775 computed by applying the transform to the moving image. If, in addition to 3776 *movtransform.mat*, the optional *reftransform.mat* file is also provided -- 3777 the moving transform is applied to the moving image, the ref transform is 3778 applied to the reference image, and the metric is computed in an image space 3779 that is physically halfway between the reference and moving images. This may 3780 be useful for unbiased metric computation if the two transforms are inverse 3781 of each other as both images undergo similar amount of interpolation. The 3782 definitions of reference and moving images and the transform file format are 3783 similar to the **-reslice-matrix** command. 3784 3785 # Compute metric between ref.nii and mov.nii 3786 c3d ref.nii mov.nii -msq 3787 3788 # Compute metric between ref.nii and mov.nii after applying transform to 3789 mov.nii 3790 c3d ref.nii mov.nii -msq tmov.mat 3791 3792 # Compute metric between ref.nii and mov.nii in a neutral space after 3793 applying transforms to both 3794 c3d ref.nii mov.nii -msq tmov.mat tref.mat. 3795 """ 3796 mean_square: str 3797 """-msq, -mean-square: Compute mean square difference metric 3798 3799 Syntax: `-msq [movtransform.mat] [reftransform.mat]` 3800 3801 Compute the mean square difference metric between the last two images on the 3802 stack. If an optional *movtransform.mat* file is provided, the metric is 3803 computed by applying the transform to the moving image. If, in addition to 3804 *movtransform.mat*, the optional *reftransform.mat* file is also provided -- 3805 the moving transform is applied to the moving image, the ref transform is 3806 applied to the reference image, and the metric is computed in an image space 3807 that is physically halfway between the reference and moving images. This may 3808 be useful for unbiased metric computation if the two transforms are inverse 3809 of each other as both images undergo similar amount of interpolation. The 3810 definitions of reference and moving images and the transform file format are 3811 similar to the **-reslice-matrix** command. 3812 3813 # Compute metric between ref.nii and mov.nii 3814 c3d ref.nii mov.nii -msq 3815 3816 # Compute metric between ref.nii and mov.nii after applying transform to 3817 mov.nii 3818 c3d ref.nii mov.nii -msq tmov.mat 3819 3820 # Compute metric between ref.nii and mov.nii in a neutral space after 3821 applying transforms to both 3822 c3d ref.nii mov.nii -msq tmov.mat tref.mat""" 3823 3824 def run( 3825 self, 3826 execution: Execution, 3827 ) -> list[str]: 3828 """ 3829 Build command line arguments. This method is called by the main command. 3830 3831 Args: 3832 execution: The execution object. 3833 Returns: 3834 Command line arguments 3835 """ 3836 cargs = [] 3837 cargs.extend([ 3838 "-msq", 3839 self.mean_square 3840 ]) 3841 return cargs 3842 3843 3844@dataclasses.dataclass 3845class C3dMultiply: 3846 """ 3847 -multiply, -times: Multiply two images 3848 3849 Syntax: `-multiply` 3850 3851 Multiply two images voxel-by-voxel. The operation is applied to the last two 3852 images on the stack. 3853 3854 # Compute x = a * b 3855 c3d a.img b.img -multiply -o x.img 3856 3857 # Compute x = a * (b + c) using add and -multiply 3858 c3d a.img b.img c.img -multiply -add -o x.img 3859 3860 Combine with the **-dup** command to compute voxelwise square of the image 3861 3862 # Compute x = a^2 3863 c3d a.img -dup -multiply -o x.img. 3864 """ 3865 multiply: str 3866 """-multiply, -times: Multiply two images 3867 3868 Syntax: `-multiply` 3869 3870 Multiply two images voxel-by-voxel. The operation is applied to the last two 3871 images on the stack. 3872 3873 # Compute x = a * b 3874 c3d a.img b.img -multiply -o x.img 3875 3876 # Compute x = a * (b + c) using add and -multiply 3877 c3d a.img b.img c.img -multiply -add -o x.img 3878 3879 Combine with the **-dup** command to compute voxelwise square of the image 3880 3881 # Compute x = a^2 3882 c3d a.img -dup -multiply -o x.img""" 3883 3884 def run( 3885 self, 3886 execution: Execution, 3887 ) -> list[str]: 3888 """ 3889 Build command line arguments. This method is called by the main command. 3890 3891 Args: 3892 execution: The execution object. 3893 Returns: 3894 Command line arguments 3895 """ 3896 cargs = [] 3897 cargs.extend([ 3898 "-multiply", 3899 self.multiply 3900 ]) 3901 return cargs 3902 3903 3904@dataclasses.dataclass 3905class C3dNormalizedCrossCorrelation: 3906 """ 3907 -ncc, -normalized-cross-correlation: Compute normalized cross-correlation 3908 image 3909 3910 Syntax: `-ncc <radius_vector>` 3911 3912 Computes normalized cross-correlation between two images that occupy the 3913 same physical space. Each voxel in the resulting image is the 3914 cross-correlation of patches of given radius surrounding the voxel in the 3915 two input images. This is different from **-ncor**, which computes a global 3916 cross-correlation metric value. 3917 """ 3918 normalized_cross_correlation: str 3919 """-ncc, -normalized-cross-correlation: Compute normalized cross-correlation 3920 image 3921 3922 Syntax: `-ncc <radius_vector>` 3923 3924 Computes normalized cross-correlation between two images that occupy the 3925 same physical space. Each voxel in the resulting image is the 3926 cross-correlation of patches of given radius surrounding the voxel in the 3927 two input images. This is different from **-ncor**, which computes a global 3928 cross-correlation metric value.""" 3929 3930 def run( 3931 self, 3932 execution: Execution, 3933 ) -> list[str]: 3934 """ 3935 Build command line arguments. This method is called by the main command. 3936 3937 Args: 3938 execution: The execution object. 3939 Returns: 3940 Command line arguments 3941 """ 3942 cargs = [] 3943 cargs.extend([ 3944 "-ncc", 3945 self.normalized_cross_correlation 3946 ]) 3947 return cargs 3948 3949 3950@dataclasses.dataclass 3951class C3dNormalizedCorrelation: 3952 """ 3953 -ncor, -normalized-correlation: Compute normalized correlation metric 3954 3955 Syntax: `-ncor [movtransform.mat] [reftransform.mat]` 3956 3957 : Compute the normalized correlation metric between the last two images on 3958 the stack. See documentation for **-msq***. 3959 """ 3960 normalized_correlation: str 3961 """-ncor, -normalized-correlation: Compute normalized correlation metric 3962 3963 Syntax: `-ncor [movtransform.mat] [reftransform.mat]` 3964 3965 : Compute the normalized correlation metric between the last two images on 3966 the stack. See documentation for **-msq***.""" 3967 3968 def run( 3969 self, 3970 execution: Execution, 3971 ) -> list[str]: 3972 """ 3973 Build command line arguments. This method is called by the main command. 3974 3975 Args: 3976 execution: The execution object. 3977 Returns: 3978 Command line arguments 3979 """ 3980 cargs = [] 3981 cargs.extend([ 3982 "-ncor", 3983 self.normalized_correlation 3984 ]) 3985 return cargs 3986 3987 3988@dataclasses.dataclass 3989class C3dNormalizedMutualInfo: 3990 """ 3991 -mmi, -mattes-mutual-info: Compute mutual informaiton metric 3992 3993 Syntax: `-nmi [movtransform.mat] [reftransform.mat]` 3994 3995 Compute the Mattes mutual information metric between the last two images on 3996 the stack. See documentation for **-msq**. 3997 """ 3998 normalized_mutual_info: str 3999 """-mmi, -mattes-mutual-info: Compute mutual informaiton metric 4000 4001 Syntax: `-nmi [movtransform.mat] [reftransform.mat]` 4002 4003 Compute the Mattes mutual information metric between the last two images on 4004 the stack. See documentation for **-msq**.""" 4005 4006 def run( 4007 self, 4008 execution: Execution, 4009 ) -> list[str]: 4010 """ 4011 Build command line arguments. This method is called by the main command. 4012 4013 Args: 4014 execution: The execution object. 4015 Returns: 4016 Command line arguments 4017 """ 4018 cargs = [] 4019 cargs.extend([ 4020 "-nmi", 4021 self.normalized_mutual_info 4022 ]) 4023 return cargs 4024 4025 4026@dataclasses.dataclass 4027class C3dNoiseGaussian: 4028 """ 4029 -noise-gaussian, -noise: Apply additive Gaussian noise 4030 4031 Syntax: `-noise-gaussian <sigma>` 4032 4033 Adds Gaussian noise to an image with zero mean and standard deviation sigma. 4034 Please see [Noise simulation article][15] by G. Lehmann for details. 4035 4036 c3d image.nii -noise-gaussian 5 -o noisy.nii. 4037 """ 4038 noise_gaussian: str 4039 """-noise-gaussian, -noise: Apply additive Gaussian noise 4040 4041 Syntax: `-noise-gaussian <sigma>` 4042 4043 Adds Gaussian noise to an image with zero mean and standard deviation sigma. 4044 Please see [Noise simulation article][15] by G. Lehmann for details. 4045 4046 c3d image.nii -noise-gaussian 5 -o noisy.nii""" 4047 4048 def run( 4049 self, 4050 execution: Execution, 4051 ) -> list[str]: 4052 """ 4053 Build command line arguments. This method is called by the main command. 4054 4055 Args: 4056 execution: The execution object. 4057 Returns: 4058 Command line arguments 4059 """ 4060 cargs = [] 4061 cargs.extend([ 4062 "-noise-gaussian", 4063 self.noise_gaussian 4064 ]) 4065 return cargs 4066 4067 4068@dataclasses.dataclass 4069class C3dNoisePoisson: 4070 """ 4071 -noise-poisson: Apply Poisson noise 4072 Syntax: `-noise-poisson <scale>` 4073 4074 Applies Poisson (shot) noise to an image with given scale. Please see [Noise 4075 simulation article][15] by G. Lehmann for details. 4076 4077 c3d image.nii -noise-poisson 5 -o noisy.nii. 4078 """ 4079 noise_poisson: str 4080 """-noise-poisson: Apply Poisson noise 4081 Syntax: `-noise-poisson <scale>` 4082 4083 Applies Poisson (shot) noise to an image with given scale. Please see [Noise 4084 simulation article][15] by G. Lehmann for details. 4085 4086 c3d image.nii -noise-poisson 5 -o noisy.nii""" 4087 4088 def run( 4089 self, 4090 execution: Execution, 4091 ) -> list[str]: 4092 """ 4093 Build command line arguments. This method is called by the main command. 4094 4095 Args: 4096 execution: The execution object. 4097 Returns: 4098 Command line arguments 4099 """ 4100 cargs = [] 4101 cargs.extend([ 4102 "-noise-poisson", 4103 self.noise_poisson 4104 ]) 4105 return cargs 4106 4107 4108@dataclasses.dataclass 4109class C3dNoiseSpeckle: 4110 """ 4111 -noise-speckle: Apply Poisson noise 4112 Syntax: `-noise-speckle <sigma>` 4113 4114 Applies Speckle noise to an image with given standard deviation. Please see 4115 [Noise simulation article][15] by G. Lehmann for details. 4116 4117 c3d image.nii -noise-speckle 5 -o noisy.nii. 4118 """ 4119 noise_speckle: str 4120 """-noise-speckle: Apply Poisson noise 4121 Syntax: `-noise-speckle <sigma>` 4122 4123 Applies Speckle noise to an image with given standard deviation. Please see 4124 [Noise simulation article][15] by G. Lehmann for details. 4125 4126 c3d image.nii -noise-speckle 5 -o noisy.nii""" 4127 4128 def run( 4129 self, 4130 execution: Execution, 4131 ) -> list[str]: 4132 """ 4133 Build command line arguments. This method is called by the main command. 4134 4135 Args: 4136 execution: The execution object. 4137 Returns: 4138 Command line arguments 4139 """ 4140 cargs = [] 4141 cargs.extend([ 4142 "-noise-speckle", 4143 self.noise_speckle 4144 ]) 4145 return cargs 4146 4147 4148@dataclasses.dataclass 4149class C3dNoiseSaltPepper: 4150 """ 4151 -noise-salt-pepper: Apply salt and pepper noise 4152 Syntax: `-noise-salt-pepper <probability>` 4153 4154 Applies salt and pepper noise to an image with given probability. Please see 4155 [Noise simulation article][15] by G. Lehmann for details. 4156 4157 c3d image.nii -noise-salt-pepper 0.1 -o noisy.nii. 4158 """ 4159 noise_salt_pepper: str 4160 """-noise-salt-pepper: Apply salt and pepper noise 4161 Syntax: `-noise-salt-pepper <probability>` 4162 4163 Applies salt and pepper noise to an image with given probability. Please see 4164 [Noise simulation article][15] by G. Lehmann for details. 4165 4166 c3d image.nii -noise-salt-pepper 0.1 -o noisy.nii""" 4167 4168 def run( 4169 self, 4170 execution: Execution, 4171 ) -> list[str]: 4172 """ 4173 Build command line arguments. This method is called by the main command. 4174 4175 Args: 4176 execution: The execution object. 4177 Returns: 4178 Command line arguments 4179 """ 4180 cargs = [] 4181 cargs.extend([ 4182 "-noise-salt-pepper", 4183 self.noise_salt_pepper 4184 ]) 4185 return cargs 4186 4187 4188@dataclasses.dataclass 4189class C3dNoMulticomponentSplit: 4190 """ 4191 -nomcs, -no-multicomponent-split: Disable splitting of multi-component 4192 images on read 4193 4194 Syntax: `-nomcs` 4195 4196 Used to reverse the effect of previous **-mcs** command. 4197 """ 4198 no_multicomponent_split: str 4199 """-nomcs, -no-multicomponent-split: Disable splitting of multi-component 4200 images on read 4201 4202 Syntax: `-nomcs` 4203 4204 Used to reverse the effect of previous **-mcs** command.""" 4205 4206 def run( 4207 self, 4208 execution: Execution, 4209 ) -> list[str]: 4210 """ 4211 Build command line arguments. This method is called by the main command. 4212 4213 Args: 4214 execution: The execution object. 4215 Returns: 4216 Command line arguments 4217 """ 4218 cargs = [] 4219 cargs.extend([ 4220 "-nomcs", 4221 self.no_multicomponent_split 4222 ]) 4223 return cargs 4224 4225 4226@dataclasses.dataclass 4227class C3dNormalizeLocalWindow: 4228 """ 4229 -nlw, -normalize-local-window: Standardize image intensity using local 4230 neighborhood 4231 4232 Syntax: `-nlw <radius>` 4233 4234 This command takes as inputs an image and a mask image. At each voxel, the 4235 mean of the local neighborhood is subtracted, and the result is divided by 4236 the standard deviation of the neighborhood. The mean and standard deviation 4237 are computed only over the masked region. You might also want to multiply by 4238 the mask. 4239 4240 c3d gray.nii.gz mask.nii.gz -nlw 10x10x10 -o residual.nii.gz. 4241 """ 4242 normalize_local_window: str 4243 """-nlw, -normalize-local-window: Standardize image intensity using local 4244 neighborhood 4245 4246 Syntax: `-nlw <radius>` 4247 4248 This command takes as inputs an image and a mask image. At each voxel, the 4249 mean of the local neighborhood is subtracted, and the result is divided by 4250 the standard deviation of the neighborhood. The mean and standard deviation 4251 are computed only over the masked region. You might also want to multiply by 4252 the mask. 4253 4254 c3d gray.nii.gz mask.nii.gz -nlw 10x10x10 -o residual.nii.gz""" 4255 4256 def run( 4257 self, 4258 execution: Execution, 4259 ) -> list[str]: 4260 """ 4261 Build command line arguments. This method is called by the main command. 4262 4263 Args: 4264 execution: The execution object. 4265 Returns: 4266 Command line arguments 4267 """ 4268 cargs = [] 4269 cargs.extend([ 4270 "-nlw", 4271 self.normalize_local_window 4272 ]) 4273 return cargs 4274 4275 4276@dataclasses.dataclass 4277class C3dNormpdf: 4278 """ 4279 No description found. 4280 """ 4281 normpdf: str 4282 """No description found.""" 4283 4284 def run( 4285 self, 4286 execution: Execution, 4287 ) -> list[str]: 4288 """ 4289 Build command line arguments. This method is called by the main command. 4290 4291 Args: 4292 execution: The execution object. 4293 Returns: 4294 Command line arguments 4295 """ 4296 cargs = [] 4297 cargs.extend([ 4298 "-normpdf", 4299 self.normpdf 4300 ]) 4301 return cargs 4302 4303 4304@dataclasses.dataclass 4305class C3dNoround: 4306 """ 4307 -noround, -round: Floating point rounding behavior 4308 4309 Syntax: `-noround` or `-round ` 4310 4311 By default, **convert3d** will round floating point values when converting 4312 to an integer, short or byte image. This command specifies that rounding 4313 should not be used. Rounding is used to avoid numerical errors stemming from 4314 the internal floating point representation. 4315 4316 c3d image1.img -type short -noround image2.img. 4317 """ 4318 noround: str 4319 """-noround, -round: Floating point rounding behavior 4320 4321 Syntax: `-noround` or `-round ` 4322 4323 By default, **convert3d** will round floating point values when converting 4324 to an integer, short or byte image. This command specifies that rounding 4325 should not be used. Rounding is used to avoid numerical errors stemming from 4326 the internal floating point representation. 4327 4328 c3d image1.img -type short -noround image2.img""" 4329 4330 def run( 4331 self, 4332 execution: Execution, 4333 ) -> list[str]: 4334 """ 4335 Build command line arguments. This method is called by the main command. 4336 4337 Args: 4338 execution: The execution object. 4339 Returns: 4340 Command line arguments 4341 """ 4342 cargs = [] 4343 cargs.extend([ 4344 "-noround", 4345 self.noround 4346 ]) 4347 return cargs 4348 4349 4350@dataclasses.dataclass 4351class C3dNospm: 4352 """ 4353 -spm, -nospm: SPM compatibility in Analyze output 4354 4355 Syntax: `-spm` or `-nospm ` 4356 4357 These options specify whether use the SPM extension to the Analyze 4358 (.hdr,.img) format. When this option is on, the origin field stored by SPM 4359 in the Analyze header will be correctly interpreted. When saving analyze 4360 files, the origin will be set correctly. The default is equivalent to the 4361 **-nospm** option. Best to avoid this issue altogether by using NIFTI and 4362 SPM5 or later. 4363 4364 c3d -spm in.hdr out.img.gz. 4365 """ 4366 nospm: str 4367 """-spm, -nospm: SPM compatibility in Analyze output 4368 4369 Syntax: `-spm` or `-nospm ` 4370 4371 These options specify whether use the SPM extension to the Analyze 4372 (.hdr,.img) format. When this option is on, the origin field stored by SPM 4373 in the Analyze header will be correctly interpreted. When saving analyze 4374 files, the origin will be set correctly. The default is equivalent to the 4375 **-nospm** option. Best to avoid this issue altogether by using NIFTI and 4376 SPM5 or later. 4377 4378 c3d -spm in.hdr out.img.gz""" 4379 4380 def run( 4381 self, 4382 execution: Execution, 4383 ) -> list[str]: 4384 """ 4385 Build command line arguments. This method is called by the main command. 4386 4387 Args: 4388 execution: The execution object. 4389 Returns: 4390 Command line arguments 4391 """ 4392 cargs = [] 4393 cargs.extend([ 4394 "-nospm", 4395 self.nospm 4396 ]) 4397 return cargs 4398 4399 4400class C3dOutputOutputs(typing.NamedTuple): 4401 """ 4402 Output object returned when calling `C3dOutput(...)`. 4403 """ 4404 root: OutputPathType 4405 """Output root folder. This is the root folder for all outputs.""" 4406 output: OutputPathType 4407 """The output""" 4408 4409 4410@dataclasses.dataclass 4411class C3dOutput: 4412 """ 4413 -o: Output (write) last image on the stack to image file 4414 4415 Syntax: `-o filename` 4416 4417 Write image, overriding an existing image. Without the **-o** option, 4418 **convert3d** will write an image only if it does not exist. The **-o** 4419 options protects input images from being accidentally deleted. Here we copy 4420 an image, changing format: 4421 4422 c3d image1.mha -o image2.nii 4423 4424 The **-o** option can also be used to save an intermediate image in the 4425 stack: 4426 4427 c3d image1.img -threshold 1 10 1 0 -o thresh.img -resample 50% -o final.img. 4428 """ 4429 output: str 4430 """-o: Output (write) last image on the stack to image file 4431 4432 Syntax: `-o filename` 4433 4434 Write image, overriding an existing image. Without the **-o** option, 4435 **convert3d** will write an image only if it does not exist. The **-o** 4436 options protects input images from being accidentally deleted. Here we copy 4437 an image, changing format: 4438 4439 c3d image1.mha -o image2.nii 4440 4441 The **-o** option can also be used to save an intermediate image in the 4442 stack: 4443 4444 c3d image1.img -threshold 1 10 1 0 -o thresh.img -resample 50% -o 4445 final.img""" 4446 4447 def run( 4448 self, 4449 execution: Execution, 4450 ) -> list[str]: 4451 """ 4452 Build command line arguments. This method is called by the main command. 4453 4454 Args: 4455 execution: The execution object. 4456 Returns: 4457 Command line arguments 4458 """ 4459 cargs = [] 4460 cargs.extend([ 4461 "-o", 4462 self.output 4463 ]) 4464 return cargs 4465 4466 def outputs( 4467 self, 4468 execution: Execution, 4469 ) -> C3dOutputOutputs: 4470 """ 4471 Collect output file paths. 4472 4473 Args: 4474 execution: The execution object. 4475 Returns: 4476 NamedTuple of outputs (described in `C3dOutputOutputs`). 4477 """ 4478 ret = C3dOutputOutputs( 4479 root=execution.output_file("."), 4480 output=execution.output_file(self.output), 4481 ) 4482 return ret 4483 4484 4485@dataclasses.dataclass 4486class C3dOutputMulticomponent: 4487 """ 4488 -omc, -output-multicomponent: Output multiple images to single file 4489 4490 Syntax: `-omc [number] filename` 4491 4492 Write multiple images on the **Convert3d** stack as a single multi-component 4493 image file. If the optional number *n* is specified, only the last *n* 4494 images on the stack will be used. Not all file formats support 4495 multi-component output. NIFTI is the safest bet. 4496 4497 c3d red.nii green.nii blue.nii -omc rgb.mha 4498 4499 For 2D images, this command can be used to generate color PNG files: 4500 4501 c3d image.nii -slice z 50% -colormap jet -type uchar -omc colorslice.png. 4502 """ 4503 output_multicomponent: str 4504 """-omc, -output-multicomponent: Output multiple images to single file 4505 4506 Syntax: `-omc [number] filename` 4507 4508 Write multiple images on the **Convert3d** stack as a single multi-component 4509 image file. If the optional number *n* is specified, only the last *n* 4510 images on the stack will be used. Not all file formats support 4511 multi-component output. NIFTI is the safest bet. 4512 4513 c3d red.nii green.nii blue.nii -omc rgb.mha 4514 4515 For 2D images, this command can be used to generate color PNG files: 4516 4517 c3d image.nii -slice z 50% -colormap jet -type uchar -omc colorslice.png""" 4518 4519 def run( 4520 self, 4521 execution: Execution, 4522 ) -> list[str]: 4523 """ 4524 Build command line arguments. This method is called by the main command. 4525 4526 Args: 4527 execution: The execution object. 4528 Returns: 4529 Command line arguments 4530 """ 4531 cargs = [] 4532 cargs.extend([ 4533 "-omc", 4534 self.output_multicomponent 4535 ]) 4536 return cargs 4537 4538 4539@dataclasses.dataclass 4540class C3dOutputMultipleMulticomponent: 4541 """ 4542 -oomc: Output multiple multi-component images to multiple files 4543 4544 Syntax: `-oomc n_comp image_list` or `-oomc n_comp image_spec` 4545 4546 Write all images on the **convert3d** stack as multiple multi-component 4547 image files. The command is a mixture of the **-omc** and **-oo** commands. 4548 There must be a multiple of 'n_comp' images on the stack. Every consecutive 4549 'n_comp' images on the stack will be written to a separate multi-component 4550 image. 4551 4552 ### Commands: Stack Manipulation and Flow Control 4553 4554 These commands are used to manipulate the **convert3d** stack. The stack is 4555 a linear array of images. Every time an image is specified on the command 4556 line, it is loaded and placed at the end of the stack. Most operations take 4557 one image from the end of the stack, apply some operation to it, and place 4558 the result on the end of the stack. Certain commands like **-levelset** and 4559 **-reslice-matrix** take two images from the end of the stack as the input 4560 and replace them with a single output. Some other commands, like **-mean** 4561 and **-vote** take all images on the stack and replace them with a single 4562 output. 4563 4564 Sometimes, for complex operations, it is useful to change the order of the 4565 images on the stack, to duplicate images, or to execute the same command 4566 multiple times. The stack manipulation and flow control commands allow you 4567 to complete complex tasks without saving intermediate images to the disk. 4568 """ 4569 output_multiple_multicomponent: str 4570 """-oomc: Output multiple multi-component images to multiple files 4571 4572 Syntax: `-oomc n_comp image_list` or `-oomc n_comp image_spec` 4573 4574 Write all images on the **convert3d** stack as multiple multi-component 4575 image files. The command is a mixture of the **-omc** and **-oo** commands. 4576 There must be a multiple of 'n_comp' images on the stack. Every consecutive 4577 'n_comp' images on the stack will be written to a separate multi-component 4578 image. 4579 4580 ### Commands: Stack Manipulation and Flow Control 4581 4582 These commands are used to manipulate the **convert3d** stack. The stack is 4583 a linear array of images. Every time an image is specified on the command 4584 line, it is loaded and placed at the end of the stack. Most operations take 4585 one image from the end of the stack, apply some operation to it, and place 4586 the result on the end of the stack. Certain commands like **-levelset** and 4587 **-reslice-matrix** take two images from the end of the stack as the input 4588 and replace them with a single output. Some other commands, like **-mean** 4589 and **-vote** take all images on the stack and replace them with a single 4590 output. 4591 4592 Sometimes, for complex operations, it is useful to change the order of the 4593 images on the stack, to duplicate images, or to execute the same command 4594 multiple times. The stack manipulation and flow control commands allow you 4595 to complete complex tasks without saving intermediate images to the disk.""" 4596 4597 def run( 4598 self, 4599 execution: Execution, 4600 ) -> list[str]: 4601 """ 4602 Build command line arguments. This method is called by the main command. 4603 4604 Args: 4605 execution: The execution object. 4606 Returns: 4607 Command line arguments 4608 """ 4609 cargs = [] 4610 cargs.extend([ 4611 "-oomc", 4612 self.output_multiple_multicomponent 4613 ]) 4614 return cargs 4615 4616 4617@dataclasses.dataclass 4618class C3dOrient: 4619 """ 4620 -orient: Change image orientation 4621 4622 Syntax: `-orient CODE` 4623 4624 Set the orientation of the image using one of 48 canonical orientations. The 4625 orientation describes the mapping from the voxel coordinate system (i,j,k) 4626 to the physical coordinate system (x,y,z). In the voxel coordinate system, i 4627 runs along columns of voxels, j runs along rows of voxels, and k runs along 4628 slices of voxels. It is assumed (by the NIFTI convention) that the axes of 4629 the physical coordinate system run as follows: x from (L)eft to (R)ight, y 4630 from (P)osterior to (A)nterior, z from (I)nferior to (S)uperior. 4631 4632 The CODE passed in is a three-letter code consisting of letters RLAPSI. Each 4633 letter describes the anatomical direction corresponding to the voxel 4634 coordinates (i,j,k). For example, code RAI means that i runs from Right to 4635 Left, j from Anterior to Posterior, and k from Inferior to Superior. 4636 4637 c3d input.img -orient RAI -o output.img 4638 c3d input.img -orient SAL -o output.img 4639 4640 This command has the same behavior as the 'Reorient Image' menu option in 4641 ITK-SNAP. 4642 """ 4643 orient: str 4644 """-orient: Change image orientation 4645 4646 Syntax: `-orient CODE` 4647 4648 Set the orientation of the image using one of 48 canonical orientations. The 4649 orientation describes the mapping from the voxel coordinate system (i,j,k) 4650 to the physical coordinate system (x,y,z). In the voxel coordinate system, i 4651 runs along columns of voxels, j runs along rows of voxels, and k runs along 4652 slices of voxels. It is assumed (by the NIFTI convention) that the axes of 4653 the physical coordinate system run as follows: x from (L)eft to (R)ight, y 4654 from (P)osterior to (A)nterior, z from (I)nferior to (S)uperior. 4655 4656 The CODE passed in is a three-letter code consisting of letters RLAPSI. Each 4657 letter describes the anatomical direction corresponding to the voxel 4658 coordinates (i,j,k). For example, code RAI means that i runs from Right to 4659 Left, j from Anterior to Posterior, and k from Inferior to Superior. 4660 4661 c3d input.img -orient RAI -o output.img 4662 c3d input.img -orient SAL -o output.img 4663 4664 This command has the same behavior as the 'Reorient Image' menu option in 4665 ITK-SNAP.""" 4666 4667 def run( 4668 self, 4669 execution: Execution, 4670 ) -> list[str]: 4671 """ 4672 Build command line arguments. This method is called by the main command. 4673 4674 Args: 4675 execution: The execution object. 4676 Returns: 4677 Command line arguments 4678 """ 4679 cargs = [] 4680 cargs.extend([ 4681 "-orient", 4682 self.orient 4683 ]) 4684 return cargs 4685 4686 4687@dataclasses.dataclass 4688class C3dOutputMultiple: 4689 """ 4690 -oo: Output multiple images to multiple files 4691 4692 Syntax: `-oo image_list` or `-oo image_spec` 4693 4694 Write all images on the **convert3d** stack as multiple files. There are two 4695 ways to use this command. The first is to supply a list of file names, 4696 separated by spaces: 4697 4698 c3d labelimage.nii -split -oo labelA.nii labelB.nii labelC.nii 4699 4700 In the above example, the image at the end of the stack will be saved as 4701 *labelC.nii*, the image next to the end of the stack will be saved as 4702 *labelB.nii* and so on. 4703 4704 The second way to use the **-oo** command is to supply a pattern for the 4705 output filenames. In this case, all the images on the stack will be written. 4706 The format for the pattern is the same as for the [C++ printf command][8]. 4707 For example, the following command 4708 4709 c3d labelimage.nii -split -oo label%02d.nii 4710 4711 will generate images *label00.nii*, *label01.nii*, *label02.nii* and so on. 4712 The image at the end of the stack will have the highest number, and the 4713 image at the beginning of the stack will have number 00. 4714 """ 4715 output_multiple: str 4716 """-oo: Output multiple images to multiple files 4717 4718 Syntax: `-oo image_list` or `-oo image_spec` 4719 4720 Write all images on the **convert3d** stack as multiple files. There are two 4721 ways to use this command. The first is to supply a list of file names, 4722 separated by spaces: 4723 4724 c3d labelimage.nii -split -oo labelA.nii labelB.nii labelC.nii 4725 4726 In the above example, the image at the end of the stack will be saved as 4727 *labelC.nii*, the image next to the end of the stack will be saved as 4728 *labelB.nii* and so on. 4729 4730 The second way to use the **-oo** command is to supply a pattern for the 4731 output filenames. In this case, all the images on the stack will be written. 4732 The format for the pattern is the same as for the [C++ printf command][8]. 4733 For example, the following command 4734 4735 c3d labelimage.nii -split -oo label%02d.nii 4736 4737 will generate images *label00.nii*, *label01.nii*, *label02.nii* and so on. 4738 The image at the end of the stack will have the highest number, and the 4739 image at the beginning of the stack will have number 00.""" 4740 4741 def run( 4742 self, 4743 execution: Execution, 4744 ) -> list[str]: 4745 """ 4746 Build command line arguments. This method is called by the main command. 4747 4748 Args: 4749 execution: The execution object. 4750 Returns: 4751 Command line arguments 4752 """ 4753 cargs = [] 4754 cargs.extend([ 4755 "-oo", 4756 self.output_multiple 4757 ]) 4758 return cargs 4759 4760 4761@dataclasses.dataclass 4762class C3dOrient_: 4763 """ 4764 -orient: Change image orientation 4765 4766 Syntax: `-orient CODE` 4767 4768 Set the orientation of the image using one of 48 canonical orientations. The 4769 orientation describes the mapping from the voxel coordinate system (i,j,k) 4770 to the physical coordinate system (x,y,z). In the voxel coordinate system, i 4771 runs along columns of voxels, j runs along rows of voxels, and k runs along 4772 slices of voxels. It is assumed (by the NIFTI convention) that the axes of 4773 the physical coordinate system run as follows: x from (L)eft to (R)ight, y 4774 from (P)osterior to (A)nterior, z from (I)nferior to (S)uperior. 4775 4776 The CODE passed in is a three-letter code consisting of letters RLAPSI. Each 4777 letter describes the anatomical direction corresponding to the voxel 4778 coordinates (i,j,k). For example, code RAI means that i runs from Right to 4779 Left, j from Anterior to Posterior, and k from Inferior to Superior. 4780 4781 c3d input.img -orient RAI -o output.img 4782 c3d input.img -orient SAL -o output.img 4783 4784 This command has the same behavior as the 'Reorient Image' menu option in 4785 ITK-SNAP. 4786 """ 4787 orient: str 4788 """-orient: Change image orientation 4789 4790 Syntax: `-orient CODE` 4791 4792 Set the orientation of the image using one of 48 canonical orientations. The 4793 orientation describes the mapping from the voxel coordinate system (i,j,k) 4794 to the physical coordinate system (x,y,z). In the voxel coordinate system, i 4795 runs along columns of voxels, j runs along rows of voxels, and k runs along 4796 slices of voxels. It is assumed (by the NIFTI convention) that the axes of 4797 the physical coordinate system run as follows: x from (L)eft to (R)ight, y 4798 from (P)osterior to (A)nterior, z from (I)nferior to (S)uperior. 4799 4800 The CODE passed in is a three-letter code consisting of letters RLAPSI. Each 4801 letter describes the anatomical direction corresponding to the voxel 4802 coordinates (i,j,k). For example, code RAI means that i runs from Right to 4803 Left, j from Anterior to Posterior, and k from Inferior to Superior. 4804 4805 c3d input.img -orient RAI -o output.img 4806 c3d input.img -orient SAL -o output.img 4807 4808 This command has the same behavior as the 'Reorient Image' menu option in 4809 ITK-SNAP.""" 4810 4811 def run( 4812 self, 4813 execution: Execution, 4814 ) -> list[str]: 4815 """ 4816 Build command line arguments. This method is called by the main command. 4817 4818 Args: 4819 execution: The execution object. 4820 Returns: 4821 Command line arguments 4822 """ 4823 cargs = [] 4824 cargs.extend([ 4825 "-orient", 4826 self.orient 4827 ]) 4828 return cargs 4829 4830 4831@dataclasses.dataclass 4832class C3dOrigin: 4833 """ 4834 -origin: Set image origin 4835 4836 Syntax: `-origin vector ` 4837 4838 Set the origin of the image. The origin is the world coordinate (in NIfTI 4839 coordinate space) of the center of the voxel (0,0,0) in the image. The 4840 origin should be specified in millimeters. 4841 4842 c3d input.img -origin 100x100x100mm -o output.img. 4843 """ 4844 origin: str 4845 """-origin: Set image origin 4846 4847 Syntax: `-origin vector ` 4848 4849 Set the origin of the image. The origin is the world coordinate (in NIfTI 4850 coordinate space) of the center of the voxel (0,0,0) in the image. The 4851 origin should be specified in millimeters. 4852 4853 c3d input.img -origin 100x100x100mm -o output.img""" 4854 4855 def run( 4856 self, 4857 execution: Execution, 4858 ) -> list[str]: 4859 """ 4860 Build command line arguments. This method is called by the main command. 4861 4862 Args: 4863 execution: The execution object. 4864 Returns: 4865 Command line arguments 4866 """ 4867 cargs = [] 4868 cargs.extend([ 4869 "-origin", 4870 self.origin 4871 ]) 4872 return cargs 4873 4874 4875@dataclasses.dataclass 4876class C3dOriginVoxel: 4877 """ 4878 -origin-voxel: Assign image origin to a voxel 4879 4880 Syntax: `-origin-voxel vector ` 4881 4882 Set the origin of the image by specifying the voxel coordinates of the 4883 center of the patient (RAS) coordinate system. The vector should be 4884 specified in voxel units. 4885 4886 c3d input.img -origin-voxel 60x70x35 -o output.img 4887 c3d input.img -origin-voxel 50% -o output.img # image centered around 4888 origin. 4889 """ 4890 origin_voxel: str 4891 """-origin-voxel: Assign image origin to a voxel 4892 4893 Syntax: `-origin-voxel vector ` 4894 4895 Set the origin of the image by specifying the voxel coordinates of the 4896 center of the patient (RAS) coordinate system. The vector should be 4897 specified in voxel units. 4898 4899 c3d input.img -origin-voxel 60x70x35 -o output.img 4900 c3d input.img -origin-voxel 50% -o output.img # image centered around 4901 origin""" 4902 4903 def run( 4904 self, 4905 execution: Execution, 4906 ) -> list[str]: 4907 """ 4908 Build command line arguments. This method is called by the main command. 4909 4910 Args: 4911 execution: The execution object. 4912 Returns: 4913 Command line arguments 4914 """ 4915 cargs = [] 4916 cargs.extend([ 4917 "-origin-voxel", 4918 self.origin_voxel 4919 ]) 4920 return cargs 4921 4922 4923@dataclasses.dataclass 4924class C3dOriginVoxelCoord: 4925 """ 4926 -origin-voxel-coord: Set coordinate of specified voxel 4927 4928 Syntax: `-origin-voxel-coord: <index> <vector>` 4929 4930 This command updates the origin of the image such that the specifed voxel 4931 has the specified coordinate. For example, you can use the command to set 4932 the world coordinate (in NIFTI coordinate space) of the center voxel of the 4933 image, as follows: 4934 4935 c3d input.nii -origin-voxel-coord: 50% 10x10x5mm -o output.nii. 4936 """ 4937 origin_voxel_coord: str 4938 """-origin-voxel-coord: Set coordinate of specified voxel 4939 4940 Syntax: `-origin-voxel-coord: <index> <vector>` 4941 4942 This command updates the origin of the image such that the specifed voxel 4943 has the specified coordinate. For example, you can use the command to set 4944 the world coordinate (in NIFTI coordinate space) of the center voxel of the 4945 image, as follows: 4946 4947 c3d input.nii -origin-voxel-coord: 50% 10x10x5mm -o output.nii""" 4948 4949 def run( 4950 self, 4951 execution: Execution, 4952 ) -> list[str]: 4953 """ 4954 Build command line arguments. This method is called by the main command. 4955 4956 Args: 4957 execution: The execution object. 4958 Returns: 4959 Command line arguments 4960 """ 4961 cargs = [] 4962 cargs.extend([ 4963 "-origin-voxel-coord", 4964 self.origin_voxel_coord 4965 ]) 4966 return cargs 4967 4968 4969@dataclasses.dataclass 4970class C3dOverlap: 4971 """ 4972 -overlap: Compute relative overlap between binary images 4973 4974 Syntax: `-overlap Z` 4975 4976 Compute relative overlap between labels in the last two images on the stack. 4977 Overlap is computed for a given label **Z**, i.e., the number of voxels that 4978 are equal to **Z** in both images is computed and divided by either the 4979 average number of voxels equal to **Z** in both images (to get Dice 4980 coefficient) or by the size of the region where at least one of the images 4981 is equal to **Z** (Jaccard coefficient). 4982 4983 The command below computes overlap for label 255. 4984 4985 c3d -verbose seg1.img seg2.img -overlap 255 4986 4987 The output of the command is in the following terse format, with the last 4988 two values giving Dice and Jaccard coefficients, respectively. 4989 4990 OVL: 1, 2383, 2474, 1807, 0.744081, 0.592459 4991 4992 Use the flag **-verbose** to get full information. 4993 4994 Matching voxels in first image: 2383 4995 Matching voxels in second image: 2474 4996 Size of overlap region: 1807 4997 Dice similarity coefficient: 0.744081 4998 Intersection / ratio: 0.592459 4999 5000 This command does not alter the stack. 5001 """ 5002 overlap: str 5003 """-overlap: Compute relative overlap between binary images 5004 5005 Syntax: `-overlap Z` 5006 5007 Compute relative overlap between labels in the last two images on the stack. 5008 Overlap is computed for a given label **Z**, i.e., the number of voxels that 5009 are equal to **Z** in both images is computed and divided by either the 5010 average number of voxels equal to **Z** in both images (to get Dice 5011 coefficient) or by the size of the region where at least one of the images 5012 is equal to **Z** (Jaccard coefficient). 5013 5014 The command below computes overlap for label 255. 5015 5016 c3d -verbose seg1.img seg2.img -overlap 255 5017 5018 The output of the command is in the following terse format, with the last 5019 two values giving Dice and Jaccard coefficients, respectively. 5020 5021 OVL: 1, 2383, 2474, 1807, 0.744081, 0.592459 5022 5023 Use the flag **-verbose** to get full information. 5024 5025 Matching voxels in first image: 2383 5026 Matching voxels in second image: 2474 5027 Size of overlap region: 1807 5028 Dice similarity coefficient: 0.744081 5029 Intersection / ratio: 0.592459 5030 5031 This command does not alter the stack.""" 5032 5033 def run( 5034 self, 5035 execution: Execution, 5036 ) -> list[str]: 5037 """ 5038 Build command line arguments. This method is called by the main command. 5039 5040 Args: 5041 execution: The execution object. 5042 Returns: 5043 Command line arguments 5044 """ 5045 cargs = [] 5046 cargs.extend([ 5047 "-overlap", 5048 self.overlap 5049 ]) 5050 return cargs 5051 5052 5053@dataclasses.dataclass 5054class C3dOverlayLabelImage: 5055 """ 5056 -oli, -overlay-label-image: Overlay segmentation image on grayscale image 5057 5058 Syntax: `-oli lookup_table_file opacity` 5059 5060 This command takes a grayscale image and a label image (i.e. image with a 5061 set of discrete values) and produces red, green and blue components of a 5062 color image. The resulting color image is an overlay of the labels over the 5063 grey image. The first parameter (*lookup\_table*) is a text file with 5064 entries in the format 5065 5066 label_value red green blue alpha 5067 5068 Alpha values must be between 0 and 1. Red, green and blue values should be 5069 on the same order as the intensity of the grey image (typically 0-255). The 5070 text file is compatible with ITK-SNAP and can be generated using the 5071 ITK-SNAP `Segmentation->Save Label Descriptions` command. The second 5072 parameter (*opacity*) is between 0 and 1 and sets the overall opacity of the 5073 overlay. The output of this command is similar to the way ITK-SNAP presents 5074 segmentation data on top of grayscale images. 5075 5076 c3d gray.nii.gz -stretch 2% 98% 0 255 -clip 0 255 seg.nii.gz -oli labels.txt 5077 0.5 -omc rgb.nii.gz 5078 5079 Note: this command does not interpolate between entries in the lookup table. 5080 It should not be used for images with a continuous intensity spectrum. 5081 5082 Here is a more complex example, used to visualize a segmentation result. We 5083 do a few things in this command: trim grayscale and segmentation images to 5084 an ROI around the object of interest; map intensity range of the grayscale 5085 image to 0-255; extract slices through the middle of the cropped images; 5086 overlay segmentation on the grayscale image; and save as a color PNG file. 5087 5088 c3d seg.nii.gz -trim 20x20x0vox -as S gray.nii.gz -stretch 2% 98% 0 255 5089 -clip 0 255 \\ 5090 -reslice-identity -push S -foreach -slice z 50% -flip xy -endfor \\ 5091 -oli labels.txt 0.5 -type uchar -omc ovl.png. 5092 """ 5093 overlay_label_image: str 5094 """-oli, -overlay-label-image: Overlay segmentation image on grayscale image 5095 5096 Syntax: `-oli lookup_table_file opacity` 5097 5098 This command takes a grayscale image and a label image (i.e. image with a 5099 set of discrete values) and produces red, green and blue components of a 5100 color image. The resulting color image is an overlay of the labels over the 5101 grey image. The first parameter (*lookup\_table*) is a text file with 5102 entries in the format 5103 5104 label_value red green blue alpha 5105 5106 Alpha values must be between 0 and 1. Red, green and blue values should be 5107 on the same order as the intensity of the grey image (typically 0-255). The 5108 text file is compatible with ITK-SNAP and can be generated using the 5109 ITK-SNAP `Segmentation->Save Label Descriptions` command. The second 5110 parameter (*opacity*) is between 0 and 1 and sets the overall opacity of the 5111 overlay. The output of this command is similar to the way ITK-SNAP presents 5112 segmentation data on top of grayscale images. 5113 5114 c3d gray.nii.gz -stretch 2% 98% 0 255 -clip 0 255 seg.nii.gz -oli labels.txt 5115 0.5 -omc rgb.nii.gz 5116 5117 Note: this command does not interpolate between entries in the lookup table. 5118 It should not be used for images with a continuous intensity spectrum. 5119 5120 Here is a more complex example, used to visualize a segmentation result. We 5121 do a few things in this command: trim grayscale and segmentation images to 5122 an ROI around the object of interest; map intensity range of the grayscale 5123 image to 0-255; extract slices through the middle of the cropped images; 5124 overlay segmentation on the grayscale image; and save as a color PNG file. 5125 5126 c3d seg.nii.gz -trim 20x20x0vox -as S gray.nii.gz -stretch 2% 98% 0 255 5127 -clip 0 255 \\ 5128 -reslice-identity -push S -foreach -slice z 50% -flip xy -endfor \\ 5129 -oli labels.txt 0.5 -type uchar -omc ovl.png""" 5130 5131 def run( 5132 self, 5133 execution: Execution, 5134 ) -> list[str]: 5135 """ 5136 Build command line arguments. This method is called by the main command. 5137 5138 Args: 5139 execution: The execution object. 5140 Returns: 5141 Command line arguments 5142 """ 5143 cargs = [] 5144 cargs.extend([ 5145 "-overlay-label-image", 5146 self.overlay_label_image 5147 ]) 5148 return cargs 5149 5150 5151@dataclasses.dataclass 5152class C3dPad: 5153 """ 5154 -pad: Pad image with constant value 5155 5156 Syntax: `-pad <padlower> <padupper> <value> ` 5157 5158 Pads the image by a given percentage or number of voxels. The *padlower* 5159 dimension pads along the zero faces of the image, and the *padupper* 5160 dimension pads along the upper faces of the image. For example to add 1 5161 voxel to the left side of an image, do 5162 5163 c3d img1.nii -pad 1x0x0vox 0x0x0vox 0 -o padded.nii 5164 5165 while 5166 5167 c3d img1.nii -pad 2x2x4vox 0% 0 -o padded.nii 5168 5169 adds two voxels padding to the left and posterior sides, and four slices to 5170 the bottom of the image. Note that the first argument changes the location 5171 of voxel (0,0,0) and thus the origin of the output image will be changed to 5172 maintain anatomical alignment between the padded and original images. 5173 5174 Normally you will want to pad with zeros, but you can pad with any constant 5175 value, eg : 5176 5177 c3d img1.nii -pad 10% 10% 1 -o padded.nii 5178 5179 Adds 10% to all sides of the image, and fills the new voxels with the value 5180 1. 5181 """ 5182 pad: str 5183 """-pad: Pad image with constant value 5184 5185 Syntax: `-pad <padlower> <padupper> <value> ` 5186 5187 Pads the image by a given percentage or number of voxels. The *padlower* 5188 dimension pads along the zero faces of the image, and the *padupper* 5189 dimension pads along the upper faces of the image. For example to add 1 5190 voxel to the left side of an image, do 5191 5192 c3d img1.nii -pad 1x0x0vox 0x0x0vox 0 -o padded.nii 5193 5194 while 5195 5196 c3d img1.nii -pad 2x2x4vox 0% 0 -o padded.nii 5197 5198 adds two voxels padding to the left and posterior sides, and four slices to 5199 the bottom of the image. Note that the first argument changes the location 5200 of voxel (0,0,0) and thus the origin of the output image will be changed to 5201 maintain anatomical alignment between the padded and original images. 5202 5203 Normally you will want to pad with zeros, but you can pad with any constant 5204 value, eg : 5205 5206 c3d img1.nii -pad 10% 10% 1 -o padded.nii 5207 5208 Adds 10% to all sides of the image, and fills the new voxels with the value 5209 1.""" 5210 5211 def run( 5212 self, 5213 execution: Execution, 5214 ) -> list[str]: 5215 """ 5216 Build command line arguments. This method is called by the main command. 5217 5218 Args: 5219 execution: The execution object. 5220 Returns: 5221 Command line arguments 5222 """ 5223 cargs = [] 5224 cargs.extend([ 5225 "-pad", 5226 self.pad 5227 ]) 5228 return cargs 5229 5230 5231@dataclasses.dataclass 5232class C3dPadTo: 5233 """ 5234 No description found. 5235 """ 5236 pad_to: str 5237 """No description found.""" 5238 5239 def run( 5240 self, 5241 execution: Execution, 5242 ) -> list[str]: 5243 """ 5244 Build command line arguments. This method is called by the main command. 5245 5246 Args: 5247 execution: The execution object. 5248 Returns: 5249 Command line arguments 5250 """ 5251 cargs = [] 5252 cargs.extend([ 5253 "-padto", 5254 self.pad_to 5255 ]) 5256 return cargs 5257 5258 5259@dataclasses.dataclass 5260class C3dPca: 5261 """ 5262 -pca: Principal components analysis of foreground voxels 5263 5264 Syntax: `-pca` 5265 5266 Similar to the *-centroid* command, computes the centroid and prinicipal 5267 components of the foregrond voxels in the image. For example if the image is 5268 a binary image of an ellipsoid, this will report the center and the 5269 principal axes of the ellipsoid, in physical NIFTI coordinates. 5270 5271 c3d binaryimage.img -pca // centroid of all non-0 voxels 5272 c3d labelimage.img -thresh 5 5 1 0 -pca // centroid of all voxels with label 5273 5 5274 c3d labelimage.img -split -foreach -pca -endfor // centroids of all labels 5275 (including 0). 5276 """ 5277 pca: str 5278 """-pca: Principal components analysis of foreground voxels 5279 5280 Syntax: `-pca` 5281 5282 Similar to the *-centroid* command, computes the centroid and prinicipal 5283 components of the foregrond voxels in the image. For example if the image is 5284 a binary image of an ellipsoid, this will report the center and the 5285 principal axes of the ellipsoid, in physical NIFTI coordinates. 5286 5287 c3d binaryimage.img -pca // centroid of all non-0 voxels 5288 c3d labelimage.img -thresh 5 5 1 0 -pca // centroid of all voxels with label 5289 5 5290 c3d labelimage.img -split -foreach -pca -endfor // centroids of all labels 5291 (including 0)""" 5292 5293 def run( 5294 self, 5295 execution: Execution, 5296 ) -> list[str]: 5297 """ 5298 Build command line arguments. This method is called by the main command. 5299 5300 Args: 5301 execution: The execution object. 5302 Returns: 5303 Command line arguments 5304 """ 5305 cargs = [] 5306 cargs.extend([ 5307 "-pca", 5308 self.pca 5309 ]) 5310 return cargs 5311 5312 5313@dataclasses.dataclass 5314class C3dPercentIntensityMode: 5315 """ 5316 -pim, -percent-intensity-mode: Set behavior of % specifier 5317 5318 Syntax: `-pim Quantile | q | ForegroundQuantile | fq | Range | r` 5319 5320 This options changes how the percent sign (%) is interpreted when specifying 5321 intensity values. **Quantile (q)** means that `10%` describes the 10th 5322 percentile of all intensity values in the image (i.e., 10% of the voxels 5323 have lower intensity). **ForegroundQuantile (fq)** is similar, but voxels 5324 with background intensity (see **-background** option) are excluded from the 5325 percentile computation. **Range (r)** changes the meaning of percent sign 5326 from percentile to the range between the minimum and maximum of the image, 5327 and `0.1%` becomes equal to MIN + 0.1 (MAX - MIN). The default is 5328 **Quantile**. 5329 5330 $ c3d comp01.png -verbose -pim Quantile -verbose -threshold 75% inf 1 0 5331 Quantile 0.75 maps to 18 5332 5333 $ c3d comp01.png -verbose -pim ForegroundQuantile -verbose -threshold 75% 5334 inf 1 0 5335 Foreground quantile 0.75 (over 37467 voxels) maps to 58 5336 5337 $ c3d comp01.png -verbose -pim Range -verbose -threshold 75% inf 1 0 5338 Intensity range spec 0.75 maps to 191.25. 5339 """ 5340 percent_intensity_mode: str 5341 """-pim, -percent-intensity-mode: Set behavior of % specifier 5342 5343 Syntax: `-pim Quantile | q | ForegroundQuantile | fq | Range | r` 5344 5345 This options changes how the percent sign (%) is interpreted when specifying 5346 intensity values. **Quantile (q)** means that `10%` describes the 10th 5347 percentile of all intensity values in the image (i.e., 10% of the voxels 5348 have lower intensity). **ForegroundQuantile (fq)** is similar, but voxels 5349 with background intensity (see **-background** option) are excluded from the 5350 percentile computation. **Range (r)** changes the meaning of percent sign 5351 from percentile to the range between the minimum and maximum of the image, 5352 and `0.1%` becomes equal to MIN + 0.1 (MAX - MIN). The default is 5353 **Quantile**. 5354 5355 $ c3d comp01.png -verbose -pim Quantile -verbose -threshold 75% inf 1 0 5356 Quantile 0.75 maps to 18 5357 5358 $ c3d comp01.png -verbose -pim ForegroundQuantile -verbose -threshold 75% 5359 inf 1 0 5360 Foreground quantile 0.75 (over 37467 voxels) maps to 58 5361 5362 $ c3d comp01.png -verbose -pim Range -verbose -threshold 75% inf 1 0 5363 Intensity range spec 0.75 maps to 191.25""" 5364 5365 def run( 5366 self, 5367 execution: Execution, 5368 ) -> list[str]: 5369 """ 5370 Build command line arguments. This method is called by the main command. 5371 5372 Args: 5373 execution: The execution object. 5374 Returns: 5375 Command line arguments 5376 """ 5377 cargs = [] 5378 cargs.extend([ 5379 "-percent-intensity-mode", 5380 self.percent_intensity_mode 5381 ]) 5382 return cargs 5383 5384 5385@dataclasses.dataclass 5386class C3dPixel: 5387 """ 5388 No description found. 5389 """ 5390 pixel: str 5391 """No description found.""" 5392 5393 def run( 5394 self, 5395 execution: Execution, 5396 ) -> list[str]: 5397 """ 5398 Build command line arguments. This method is called by the main command. 5399 5400 Args: 5401 execution: The execution object. 5402 Returns: 5403 Command line arguments 5404 """ 5405 cargs = [] 5406 cargs.extend([ 5407 "-pixel", 5408 self.pixel 5409 ]) 5410 return cargs 5411 5412 5413@dataclasses.dataclass 5414class C3dPop: 5415 """ 5416 -pop: Remove last image from the stack 5417 5418 Syntax: `-pop` 5419 5420 Removes the last image from the image stack. Images assigned a name with the 5421 **-as** command will remain in memory. 5422 """ 5423 pop_: str 5424 """-pop: Remove last image from the stack 5425 5426 Syntax: `-pop` 5427 5428 Removes the last image from the image stack. Images assigned a name with the 5429 **-as** command will remain in memory.""" 5430 5431 def run( 5432 self, 5433 execution: Execution, 5434 ) -> list[str]: 5435 """ 5436 Build command line arguments. This method is called by the main command. 5437 5438 Args: 5439 execution: The execution object. 5440 Returns: 5441 Command line arguments 5442 """ 5443 cargs = [] 5444 cargs.extend([ 5445 "-pop", 5446 self.pop_ 5447 ]) 5448 return cargs 5449 5450 5451@dataclasses.dataclass 5452class C3dPopas: 5453 """ 5454 -popas: Remove last image from the stack and assign to variable 5455 5456 Syntax: `-popas var` 5457 5458 Removes the last image from the stack, but also assigns it the name 'var', 5459 keeping the image in memory. Same as calling **-as** *var* followed by 5460 **-pop**. 5461 """ 5462 popas: str 5463 """-popas: Remove last image from the stack and assign to variable 5464 5465 Syntax: `-popas var` 5466 5467 Removes the last image from the stack, but also assigns it the name 'var', 5468 keeping the image in memory. Same as calling **-as** *var* followed by 5469 **-pop**.""" 5470 5471 def run( 5472 self, 5473 execution: Execution, 5474 ) -> list[str]: 5475 """ 5476 Build command line arguments. This method is called by the main command. 5477 5478 Args: 5479 execution: The execution object. 5480 Returns: 5481 Command line arguments 5482 """ 5483 cargs = [] 5484 cargs.extend([ 5485 "-popas", 5486 self.popas 5487 ]) 5488 return cargs 5489 5490 5491@dataclasses.dataclass 5492class C3dProbe: 5493 """ 5494 -probe: Report image intensity at a voxel 5495 5496 Syntax: `-probe <point_spec>` 5497 5498 Prints the value of the image at the position specified by the parameter 5499 `point_spec`, which may be in physical units or voxel units: 5500 5501 c3d img1.img -probe 128x120x160vox 5502 c3d img1.img -interpolation NearestNeighbor -probe 60x60x60mm 5503 c3d img1.img -probe 50%. 5504 """ 5505 probe: str 5506 """-probe: Report image intensity at a voxel 5507 5508 Syntax: `-probe <point_spec>` 5509 5510 Prints the value of the image at the position specified by the parameter 5511 `point_spec`, which may be in physical units or voxel units: 5512 5513 c3d img1.img -probe 128x120x160vox 5514 c3d img1.img -interpolation NearestNeighbor -probe 60x60x60mm 5515 c3d img1.img -probe 50%""" 5516 5517 def run( 5518 self, 5519 execution: Execution, 5520 ) -> list[str]: 5521 """ 5522 Build command line arguments. This method is called by the main command. 5523 5524 Args: 5525 execution: The execution object. 5526 Returns: 5527 Command line arguments 5528 """ 5529 cargs = [] 5530 cargs.extend([ 5531 "-probe", 5532 self.probe 5533 ]) 5534 return cargs 5535 5536 5537@dataclasses.dataclass 5538class C3dPush: 5539 """ 5540 -push: Place variable at the end of the stack 5541 5542 Syntax: `-push var` 5543 5544 Places the image associated with variable name 'var' on end of the image 5545 stack. Variable names are assigned using the **-as** command. The **-as** 5546 and **-push** commands are useful when you need to use a certain image more 5547 than once during a convert3d operation. For example, if you want to compute 5548 the distance transform of a binary image and mask it so that the values 5549 outside of the binary image region have value 0, you would use the following 5550 command: 5551 5552 c3d binary.img -as A -sdt -push A -times -o masked_distance.img. 5553 """ 5554 push: str 5555 """-push: Place variable at the end of the stack 5556 5557 Syntax: `-push var` 5558 5559 Places the image associated with variable name 'var' on end of the image 5560 stack. Variable names are assigned using the **-as** command. The **-as** 5561 and **-push** commands are useful when you need to use a certain image more 5562 than once during a convert3d operation. For example, if you want to compute 5563 the distance transform of a binary image and mask it so that the values 5564 outside of the binary image region have value 0, you would use the following 5565 command: 5566 5567 c3d binary.img -as A -sdt -push A -times -o masked_distance.img""" 5568 5569 def run( 5570 self, 5571 execution: Execution, 5572 ) -> list[str]: 5573 """ 5574 Build command line arguments. This method is called by the main command. 5575 5576 Args: 5577 execution: The execution object. 5578 Returns: 5579 Command line arguments 5580 """ 5581 cargs = [] 5582 cargs.extend([ 5583 "-push", 5584 self.push 5585 ]) 5586 return cargs 5587 5588 5589@dataclasses.dataclass 5590class C3dRank: 5591 """ 5592 -rank: Voxelwise ranking of intensity values 5593 5594 Syntax: `-rank ` 5595 5596 This command takes N images as the input (all the images on the stack are 5597 used). It also generates N images as the output. For voxel k in image j, it 5598 assigns it a label based on its rank among the values of voxel k in all N 5599 images. If the voxel has highest intensity in image j, then the j'th output 5600 will have value 1. 5601 5602 c3d img1.img img2.img ... imgN.img -rank -oo rank%d.img. 5603 """ 5604 rank: str 5605 """-rank: Voxelwise ranking of intensity values 5606 5607 Syntax: `-rank ` 5608 5609 This command takes N images as the input (all the images on the stack are 5610 used). It also generates N images as the output. For voxel k in image j, it 5611 assigns it a label based on its rank among the values of voxel k in all N 5612 images. If the voxel has highest intensity in image j, then the j'th output 5613 will have value 1. 5614 5615 c3d img1.img img2.img ... imgN.img -rank -oo rank%d.img""" 5616 5617 def run( 5618 self, 5619 execution: Execution, 5620 ) -> list[str]: 5621 """ 5622 Build command line arguments. This method is called by the main command. 5623 5624 Args: 5625 execution: The execution object. 5626 Returns: 5627 Command line arguments 5628 """ 5629 cargs = [] 5630 cargs.extend([ 5631 "-rank", 5632 self.rank 5633 ]) 5634 return cargs 5635 5636 5637@dataclasses.dataclass 5638class C3dReciprocal: 5639 """ 5640 -reciprocal: Image voxelwise reciprocal 5641 5642 Syntax: `-reciprocal ` 5643 5644 Computes the reciprocal of an image. For instance to compute B = 1 / A, use 5645 the command 5646 5647 c3d A.img -reciprocal -o B.img. 5648 """ 5649 reciprocal: str 5650 """-reciprocal: Image voxelwise reciprocal 5651 5652 Syntax: `-reciprocal ` 5653 5654 Computes the reciprocal of an image. For instance to compute B = 1 / A, use 5655 the command 5656 5657 c3d A.img -reciprocal -o B.img""" 5658 5659 def run( 5660 self, 5661 execution: Execution, 5662 ) -> list[str]: 5663 """ 5664 Build command line arguments. This method is called by the main command. 5665 5666 Args: 5667 execution: The execution object. 5668 Returns: 5669 Command line arguments 5670 """ 5671 cargs = [] 5672 cargs.extend([ 5673 "-reciprocal", 5674 self.reciprocal 5675 ]) 5676 return cargs 5677 5678 5679@dataclasses.dataclass 5680class C3dRegion: 5681 """ 5682 -region: Extract region from image 5683 5684 Syntax: `-region vOrigin vSize ` 5685 5686 Extract a rectangular region from the image. The first parameter is the 5687 position of the corner of the region, and the second is the size of the 5688 region. 5689 5690 c3d img1.img -region 20x20x20vox 50x60x70vox -o img2.img 5691 c3d img1.img -region 25% 50% -o img3.img. 5692 """ 5693 region: str 5694 """-region: Extract region from image 5695 5696 Syntax: `-region vOrigin vSize ` 5697 5698 Extract a rectangular region from the image. The first parameter is the 5699 position of the corner of the region, and the second is the size of the 5700 region. 5701 5702 c3d img1.img -region 20x20x20vox 50x60x70vox -o img2.img 5703 c3d img1.img -region 25% 50% -o img3.img""" 5704 5705 def run( 5706 self, 5707 execution: Execution, 5708 ) -> list[str]: 5709 """ 5710 Build command line arguments. This method is called by the main command. 5711 5712 Args: 5713 execution: The execution object. 5714 Returns: 5715 Command line arguments 5716 """ 5717 cargs = [] 5718 cargs.extend([ 5719 "-region", 5720 self.region 5721 ]) 5722 return cargs 5723 5724 5725@dataclasses.dataclass 5726class C3dReorder: 5727 """ 5728 -reorder: Rearrange images on the stack 5729 5730 Syntax: `-reorder k` or `-reorder fraction` 5731 5732 Rearranges images in the stack, such that images that are k positions apart 5733 become next to each other on the stack. In other words, if the original 5734 order of the images is 1, 2, ..., n, the new order of the images becomes 1, 5735 1+k, 1+2k, ..., 2, 2+k, 2+2k, ..., k, 2k, ... n. Of course, n must be 5736 divisible by k. As an alternative to specifying k, you can specify a 5737 floating point number (i.e., **-reorder** 0.5), in which case k is obtained 5738 by multiplying n by the floating point number and rounding to the nearest 5739 integer. 5740 5741 The following three commands are equivalent: 5742 5743 c3d a1.nii a2.nii a3.nii a4.nii b1.nii b2.nii b3.nii b4.nii -reorder 4 ... 5744 c3d a1.nii a2.nii a3.nii a4.nii b1.nii b2.nii b3.nii b4.nii -reorder 0.5 ... 5745 c3d a1.nii b1.nii a2.nii b2.nii a3.nii b3.nii a4.nii b4.nii ... 5746 5747 The **-reorder** command us useful when you specify two sets of images using 5748 wildcards and then want to perform pairwise operations on the images. For 5749 example 5750 5751 c3d weight*.nii gray*.nii -reorder 0.5 -weighted-sum-voxelwise -o wsum.nii 5752 5753 is equivalent to the command 5754 5755 c3d weight1.nii gray1.nii weight2.nii gray2.nii ... -weighted-sum-voxelwise 5756 -o wsum.nii. 5757 """ 5758 reorder: str 5759 """-reorder: Rearrange images on the stack 5760 5761 Syntax: `-reorder k` or `-reorder fraction` 5762 5763 Rearranges images in the stack, such that images that are k positions apart 5764 become next to each other on the stack. In other words, if the original 5765 order of the images is 1, 2, ..., n, the new order of the images becomes 1, 5766 1+k, 1+2k, ..., 2, 2+k, 2+2k, ..., k, 2k, ... n. Of course, n must be 5767 divisible by k. As an alternative to specifying k, you can specify a 5768 floating point number (i.e., **-reorder** 0.5), in which case k is obtained 5769 by multiplying n by the floating point number and rounding to the nearest 5770 integer. 5771 5772 The following three commands are equivalent: 5773 5774 c3d a1.nii a2.nii a3.nii a4.nii b1.nii b2.nii b3.nii b4.nii -reorder 4 ... 5775 c3d a1.nii a2.nii a3.nii a4.nii b1.nii b2.nii b3.nii b4.nii -reorder 0.5 ... 5776 c3d a1.nii b1.nii a2.nii b2.nii a3.nii b3.nii a4.nii b4.nii ... 5777 5778 The **-reorder** command us useful when you specify two sets of images using 5779 wildcards and then want to perform pairwise operations on the images. For 5780 example 5781 5782 c3d weight*.nii gray*.nii -reorder 0.5 -weighted-sum-voxelwise -o wsum.nii 5783 5784 is equivalent to the command 5785 5786 c3d weight1.nii gray1.nii weight2.nii gray2.nii ... -weighted-sum-voxelwise 5787 -o wsum.nii""" 5788 5789 def run( 5790 self, 5791 execution: Execution, 5792 ) -> list[str]: 5793 """ 5794 Build command line arguments. This method is called by the main command. 5795 5796 Args: 5797 execution: The execution object. 5798 Returns: 5799 Command line arguments 5800 """ 5801 cargs = [] 5802 cargs.extend([ 5803 "-reorder", 5804 self.reorder 5805 ]) 5806 return cargs 5807 5808 5809@dataclasses.dataclass 5810class C3dRetainLabels: 5811 """ 5812 -retain-labels: Retain labels in a label image 5813 5814 Syntax: `-retain-labels I1 I2 ... IN` 5815 5816 Assuming that the input is a multi-label segmentation image, this command 5817 keeps all labels specifed in the list and replaces the remaining labels with 5818 the background value. 5819 5820 c3d seg.nii -retain-labels 2 3 4 8 -o subseg.nii. 5821 """ 5822 retain_labels: str 5823 """-retain-labels: Retain labels in a label image 5824 5825 Syntax: `-retain-labels I1 I2 ... IN` 5826 5827 Assuming that the input is a multi-label segmentation image, this command 5828 keeps all labels specifed in the list and replaces the remaining labels with 5829 the background value. 5830 5831 c3d seg.nii -retain-labels 2 3 4 8 -o subseg.nii""" 5832 5833 def run( 5834 self, 5835 execution: Execution, 5836 ) -> list[str]: 5837 """ 5838 Build command line arguments. This method is called by the main command. 5839 5840 Args: 5841 execution: The execution object. 5842 Returns: 5843 Command line arguments 5844 """ 5845 cargs = [] 5846 cargs.extend([ 5847 "-retain-labels", 5848 self.retain_labels 5849 ]) 5850 return cargs 5851 5852 5853@dataclasses.dataclass 5854class C3dRfApply: 5855 """ 5856 -rf-apply: Apply Random Forest classifier 5857 5858 Syntax: `-rf-apply <classifier_file>` 5859 5860 This command applies a classifier trained previously by **-rf-train**. The 5861 stack must contain the same number of feature images as when training. The 5862 images will be removed from the stack and replaced with a set of K 5863 probability images, where K is the number of classes during training. See 5864 examples under **-rf-train** for usage. 5865 """ 5866 rf_apply: str 5867 """-rf-apply: Apply Random Forest classifier 5868 5869 Syntax: `-rf-apply <classifier_file>` 5870 5871 This command applies a classifier trained previously by **-rf-train**. The 5872 stack must contain the same number of feature images as when training. The 5873 images will be removed from the stack and replaced with a set of K 5874 probability images, where K is the number of classes during training. See 5875 examples under **-rf-train** for usage.""" 5876 5877 def run( 5878 self, 5879 execution: Execution, 5880 ) -> list[str]: 5881 """ 5882 Build command line arguments. This method is called by the main command. 5883 5884 Args: 5885 execution: The execution object. 5886 Returns: 5887 Command line arguments 5888 """ 5889 cargs = [] 5890 cargs.extend([ 5891 "-rf-apply", 5892 self.rf_apply 5893 ]) 5894 return cargs 5895 5896 5897@dataclasses.dataclass 5898class C3dRfTrain: 5899 """ 5900 -rf-train: Train Random Forest classifier 5901 5902 Syntax: `-rf-train <classifier_file>` 5903 5904 This command trains a classifier using an implementation of the [Breyman et 5905 al. Random Forest Algorithm][Br2001], with modifications proposed by 5906 [Criminisi and Shotton][Cr2004]. The stack must contain one or more images 5907 of features (e.g., grayscale images), followed by a multi-label image. The 5908 latter must have at least two non-zero labels corresponding to different 5909 classes. The classifier is trained on a voxel by voxel basis. All voxels 5910 with label *L* are treated as the examples of class *L*. The classifier is 5911 output to a binary file that can later be used by the **-rf-apply** command. 5912 Multiple parameters can be specified with the **-rf-param-xxx** options 5913 before calling **-rf-train**. The stack is not modified by this command. 5914 5915 # Training with two MRI modalities as features and default parameters 5916 c3d t1_mri.nii t2_mri.nii segmentation.nii -rf-train myforest1.rf 5917 5918 # Training with patches as features (see docs for -rf-param-patch) 5919 c3d ultrasound.nii seg.nii -rf-param-patch 2x2x2 -rf-train myforest2.rf 5920 5921 # Applying the classifier 5922 c3d ultrasound.nii -rf-apply myforest2.rf -omc class_prob.nii.gz 5923 5924 The commands are meant to replicate the "classification" pre-segmentation 5925 mode in ITK-SNAP, i.e., extending a rough example segmentation to the entire 5926 image domain. It is possible to also use the commands to train classifiers 5927 jointly on data from multiple subjects, each with its own segmentation, as 5928 long as the images from the different subjects occupy the same image space 5929 and can be stacked into a 4-dimensional image. For example: 5930 5931 # Train using MRI and segmentations from N subjects 5932 c4d mri_subj*.nii -tile w -popas ALLMRI \ 5933 seg_subj*.nii -tile w -popas ALLSEG \ 5934 -rf-param-patch 2x2x2x0 \ 5935 -push ALLMRI -push ALLSEG -rf-train myforest.rf 5936 5937 # Apply using single MRI 5938 c4d mri_new.nii -rf-apply myforest.rf -omc classprob.nii 5939 5940 [Br2001] Breiman, L. (2001). Random forests. Machine learning, 45(1), 5-32. 5941 [Cr2004] Criminisi, A., & Shotton, J. (2013). Decision forests for computer 5942 vision and medical image analysis. Springer Science & Business Media. 5943 """ 5944 rf_train: str 5945 """-rf-train: Train Random Forest classifier 5946 5947 Syntax: `-rf-train <classifier_file>` 5948 5949 This command trains a classifier using an implementation of the [Breyman et 5950 al. Random Forest Algorithm][Br2001], with modifications proposed by 5951 [Criminisi and Shotton][Cr2004]. The stack must contain one or more images 5952 of features (e.g., grayscale images), followed by a multi-label image. The 5953 latter must have at least two non-zero labels corresponding to different 5954 classes. The classifier is trained on a voxel by voxel basis. All voxels 5955 with label *L* are treated as the examples of class *L*. The classifier is 5956 output to a binary file that can later be used by the **-rf-apply** command. 5957 Multiple parameters can be specified with the **-rf-param-xxx** options 5958 before calling **-rf-train**. The stack is not modified by this command. 5959 5960 # Training with two MRI modalities as features and default parameters 5961 c3d t1_mri.nii t2_mri.nii segmentation.nii -rf-train myforest1.rf 5962 5963 # Training with patches as features (see docs for -rf-param-patch) 5964 c3d ultrasound.nii seg.nii -rf-param-patch 2x2x2 -rf-train myforest2.rf 5965 5966 # Applying the classifier 5967 c3d ultrasound.nii -rf-apply myforest2.rf -omc class_prob.nii.gz 5968 5969 The commands are meant to replicate the "classification" pre-segmentation 5970 mode in ITK-SNAP, i.e., extending a rough example segmentation to the entire 5971 image domain. It is possible to also use the commands to train classifiers 5972 jointly on data from multiple subjects, each with its own segmentation, as 5973 long as the images from the different subjects occupy the same image space 5974 and can be stacked into a 4-dimensional image. For example: 5975 5976 # Train using MRI and segmentations from N subjects 5977 c4d mri_subj*.nii -tile w -popas ALLMRI \ 5978 seg_subj*.nii -tile w -popas ALLSEG \ 5979 -rf-param-patch 2x2x2x0 \ 5980 -push ALLMRI -push ALLSEG -rf-train myforest.rf 5981 5982 # Apply using single MRI 5983 c4d mri_new.nii -rf-apply myforest.rf -omc classprob.nii 5984 5985 [Br2001] Breiman, L. (2001). Random forests. Machine learning, 45(1), 5-32. 5986 [Cr2004] Criminisi, A., & Shotton, J. (2013). Decision forests for computer 5987 vision and medical image analysis. Springer Science & Business Media""" 5988 5989 def run( 5990 self, 5991 execution: Execution, 5992 ) -> list[str]: 5993 """ 5994 Build command line arguments. This method is called by the main command. 5995 5996 Args: 5997 execution: The execution object. 5998 Returns: 5999 Command line arguments 6000 """ 6001 cargs = [] 6002 cargs.extend([ 6003 "-rf-train", 6004 self.rf_train 6005 ]) 6006 return cargs 6007 6008 6009@dataclasses.dataclass 6010class C3dRfParamPatch: 6011 """ 6012 -rf-param-patch: Random Forest training patch size 6013 6014 Syntax: `-rf-param-patch <size_spec>` 6015 6016 Set the radius of the patch used to generate features for the RF classifier. 6017 By default this is zero, which means that just the intensity of each voxel 6018 is used as a feature. Setting this to non-zero values will result in 6019 neighboring intensities also being used as features, and can improve 6020 classification in presence of complex image texture. The patch size in each 6021 dimension is (2 * radius + 1). See **-rf-train** command for details. 6022 6023 # Set patch size to 5x5x5 6024 c3d ... -rf-param-patch 2x2x2 ... -rf-train myforest.rf. 6025 """ 6026 rf_param_patch: str 6027 """-rf-param-patch: Random Forest training patch size 6028 6029 Syntax: `-rf-param-patch <size_spec>` 6030 6031 Set the radius of the patch used to generate features for the RF classifier. 6032 By default this is zero, which means that just the intensity of each voxel 6033 is used as a feature. Setting this to non-zero values will result in 6034 neighboring intensities also being used as features, and can improve 6035 classification in presence of complex image texture. The patch size in each 6036 dimension is (2 * radius + 1). See **-rf-train** command for details. 6037 6038 # Set patch size to 5x5x5 6039 c3d ... -rf-param-patch 2x2x2 ... -rf-train myforest.rf""" 6040 6041 def run( 6042 self, 6043 execution: Execution, 6044 ) -> list[str]: 6045 """ 6046 Build command line arguments. This method is called by the main command. 6047 6048 Args: 6049 execution: The execution object. 6050 Returns: 6051 Command line arguments 6052 """ 6053 cargs = [] 6054 cargs.extend([ 6055 "-rf-param-patch", 6056 self.rf_param_patch 6057 ]) 6058 return cargs 6059 6060 6061@dataclasses.dataclass 6062class C3dRfParamUsexyz: 6063 """ 6064 -rf-param-usexyz: Random Forest coordinate features 6065 6066 Syntax: `-rf-param-usexyz` 6067 6068 Use the coordinates of voxels as additional features. This allows some 6069 geometric relations between different labels to be learned. Equivalent to 6070 the corresponding ITK-SNAP option. 6071 """ 6072 rf_param_usexyz: str 6073 """-rf-param-usexyz: Random Forest coordinate features 6074 6075 Syntax: `-rf-param-usexyz` 6076 6077 Use the coordinates of voxels as additional features. This allows some 6078 geometric relations between different labels to be learned. Equivalent to 6079 the corresponding ITK-SNAP option.""" 6080 6081 def run( 6082 self, 6083 execution: Execution, 6084 ) -> list[str]: 6085 """ 6086 Build command line arguments. This method is called by the main command. 6087 6088 Args: 6089 execution: The execution object. 6090 Returns: 6091 Command line arguments 6092 """ 6093 cargs = [] 6094 cargs.extend([ 6095 "-rf-param-usexyz", 6096 self.rf_param_usexyz 6097 ]) 6098 return cargs 6099 6100 6101@dataclasses.dataclass 6102class C3dRfParamNousexyz: 6103 """ 6104 No description found. 6105 """ 6106 rf_param_nousexyz: str 6107 """No description found.""" 6108 6109 def run( 6110 self, 6111 execution: Execution, 6112 ) -> list[str]: 6113 """ 6114 Build command line arguments. This method is called by the main command. 6115 6116 Args: 6117 execution: The execution object. 6118 Returns: 6119 Command line arguments 6120 """ 6121 cargs = [] 6122 cargs.extend([ 6123 "-rf-param-nousexyz", 6124 self.rf_param_nousexyz 6125 ]) 6126 return cargs 6127 6128 6129@dataclasses.dataclass 6130class C3dRfParamNtrees: 6131 """ 6132 -rf-param-ntrees: Random Forest forest size 6133 6134 Syntax: `-rf-param-ntrees <integer>` 6135 6136 Sets the number of trees in the forest. Default value is 50. Larger forests 6137 are more robust but more time to train and apply. 6138 """ 6139 rf_param_ntrees: str 6140 """-rf-param-ntrees: Random Forest forest size 6141 6142 Syntax: `-rf-param-ntrees <integer>` 6143 6144 Sets the number of trees in the forest. Default value is 50. Larger forests 6145 are more robust but more time to train and apply.""" 6146 6147 def run( 6148 self, 6149 execution: Execution, 6150 ) -> list[str]: 6151 """ 6152 Build command line arguments. This method is called by the main command. 6153 6154 Args: 6155 execution: The execution object. 6156 Returns: 6157 Command line arguments 6158 """ 6159 cargs = [] 6160 cargs.extend([ 6161 "-rf-param-ntrees", 6162 self.rf_param_ntrees 6163 ]) 6164 return cargs 6165 6166 6167@dataclasses.dataclass 6168class C3dRfParamTreedepth: 6169 """ 6170 -rf-param-treedepth: Random Forest tree depth 6171 6172 Syntax: `-rf-param-treedepth <integer>` 6173 6174 Sets the depth of the trees in the classifier. Default value is 30. Deeper 6175 trees can learn on more complex data but require more time. 6176 """ 6177 rf_param_treedepth: str 6178 """-rf-param-treedepth: Random Forest tree depth 6179 6180 Syntax: `-rf-param-treedepth <integer>` 6181 6182 Sets the depth of the trees in the classifier. Default value is 30. Deeper 6183 trees can learn on more complex data but require more time.""" 6184 6185 def run( 6186 self, 6187 execution: Execution, 6188 ) -> list[str]: 6189 """ 6190 Build command line arguments. This method is called by the main command. 6191 6192 Args: 6193 execution: The execution object. 6194 Returns: 6195 Command line arguments 6196 """ 6197 cargs = [] 6198 cargs.extend([ 6199 "-rf-param-treedepth", 6200 self.rf_param_treedepth 6201 ]) 6202 return cargs 6203 6204 6205@dataclasses.dataclass 6206class C3dSetSform: 6207 """ 6208 -set-sform: Set the transform to physical space 6209 6210 Syntax: `-set-sform <sform.mat> ` 6211 6212 Sets the Nifti sform of the last image on the stack to the 4x4 matrix 6213 provided. 6214 """ 6215 set_sform: str 6216 """-set-sform: Set the transform to physical space 6217 6218 Syntax: `-set-sform <sform.mat> ` 6219 6220 Sets the Nifti sform of the last image on the stack to the 4x4 matrix 6221 provided.""" 6222 6223 def run( 6224 self, 6225 execution: Execution, 6226 ) -> list[str]: 6227 """ 6228 Build command line arguments. This method is called by the main command. 6229 6230 Args: 6231 execution: The execution object. 6232 Returns: 6233 Command line arguments 6234 """ 6235 cargs = [] 6236 cargs.extend([ 6237 "-set-sform", 6238 self.set_sform 6239 ]) 6240 return cargs 6241 6242 6243@dataclasses.dataclass 6244class C3dReplace: 6245 """ 6246 -replace: Replace intensities in image 6247 6248 Syntax: `-replace I1 J1 I2 J2 ... ` 6249 6250 Replace intensity I1 by J1, I2 by J2 and so on. Allowed values of intensity 6251 include **nan**, **inf** and **-inf**. 6252 6253 c3d img1.img -replace 1 128 nan 0.0 -o img2.img. 6254 """ 6255 replace: str 6256 """-replace: Replace intensities in image 6257 6258 Syntax: `-replace I1 J1 I2 J2 ... ` 6259 6260 Replace intensity I1 by J1, I2 by J2 and so on. Allowed values of intensity 6261 include **nan**, **inf** and **-inf**. 6262 6263 c3d img1.img -replace 1 128 nan 0.0 -o img2.img""" 6264 6265 def run( 6266 self, 6267 execution: Execution, 6268 ) -> list[str]: 6269 """ 6270 Build command line arguments. This method is called by the main command. 6271 6272 Args: 6273 execution: The execution object. 6274 Returns: 6275 Command line arguments 6276 """ 6277 cargs = [] 6278 cargs.extend([ 6279 "-replace", 6280 self.replace 6281 ]) 6282 return cargs 6283 6284 6285@dataclasses.dataclass 6286class C3dResample: 6287 """ 6288 -resample: Resample image to new dimensions 6289 6290 Syntax: `-resample <dimensions> ` 6291 6292 Resamples the image, keeping the bounding box the same, but changing the 6293 number of voxels in the image. The dimensions can be specified as a 6294 percentage, for example to double the number of voxels in each direction. 6295 The **-interpolation** flag affects how sampling is performed. 6296 6297 c3d img1.img -resample 123x142x200 -o img2.img 6298 c3d img1.img -resample 200% -o img2.img 6299 c3d img1.img -resample 100x100x200% -o img2.img 6300 c3d img1.img -background 4.0 -interpolation Cubic -resample 123x142x200 -o 6301 img2.img. 6302 """ 6303 resample: str 6304 """-resample: Resample image to new dimensions 6305 6306 Syntax: `-resample <dimensions> ` 6307 6308 Resamples the image, keeping the bounding box the same, but changing the 6309 number of voxels in the image. The dimensions can be specified as a 6310 percentage, for example to double the number of voxels in each direction. 6311 The **-interpolation** flag affects how sampling is performed. 6312 6313 c3d img1.img -resample 123x142x200 -o img2.img 6314 c3d img1.img -resample 200% -o img2.img 6315 c3d img1.img -resample 100x100x200% -o img2.img 6316 c3d img1.img -background 4.0 -interpolation Cubic -resample 123x142x200 -o 6317 img2.img""" 6318 6319 def run( 6320 self, 6321 execution: Execution, 6322 ) -> list[str]: 6323 """ 6324 Build command line arguments. This method is called by the main command. 6325 6326 Args: 6327 execution: The execution object. 6328 Returns: 6329 Command line arguments 6330 """ 6331 cargs = [] 6332 cargs.extend([ 6333 "-resample", 6334 self.resample 6335 ]) 6336 return cargs 6337 6338 6339@dataclasses.dataclass 6340class C3dResampleIso: 6341 """ 6342 -resample-iso: Resample image to (approximately) isotropic resolution 6343 6344 Syntax: `-resample-iso <min|max>` 6345 6346 Resamples the image to have approximately isotropic resolution, either based 6347 on the smallest voxel dimension ('min' mode) or largest voxel dimension 6348 ('max' mode). This command calls **-resample** with appropriately calculated 6349 new image dimensions. The bounding box of the image in physical space is 6350 preserved. Therefore, since the image dimensions must be integer, the actual 6351 voxel dimensions after resampling may not be precisely isotropic. 6352 6353 c3d img1.img -resample-iso min -o img2.img. 6354 """ 6355 resample_iso: str 6356 """-resample-iso: Resample image to (approximately) isotropic resolution 6357 6358 Syntax: `-resample-iso <min|max>` 6359 6360 Resamples the image to have approximately isotropic resolution, either based 6361 on the smallest voxel dimension ('min' mode) or largest voxel dimension 6362 ('max' mode). This command calls **-resample** with appropriately calculated 6363 new image dimensions. The bounding box of the image in physical space is 6364 preserved. Therefore, since the image dimensions must be integer, the actual 6365 voxel dimensions after resampling may not be precisely isotropic. 6366 6367 c3d img1.img -resample-iso min -o img2.img""" 6368 6369 def run( 6370 self, 6371 execution: Execution, 6372 ) -> list[str]: 6373 """ 6374 Build command line arguments. This method is called by the main command. 6375 6376 Args: 6377 execution: The execution object. 6378 Returns: 6379 Command line arguments 6380 """ 6381 cargs = [] 6382 cargs.extend([ 6383 "-resample-iso", 6384 self.resample_iso 6385 ]) 6386 return cargs 6387 6388 6389@dataclasses.dataclass 6390class C3dResampleMm: 6391 """ 6392 -resample-mm: Resample image to new resolution 6393 6394 Syntax: `-resample-mm <voxel_size> ` 6395 6396 Resamples the image as in **-resample**, but the user specifies the new 6397 voxel size rather than dimensions. This may not be precise, so the bounding 6398 box of the image may change. A warning will be generated in that case. 6399 6400 c3d img1.img -resample-mm 1.0x1.5x1.5mm -o img2.img. 6401 """ 6402 resample_mm: str 6403 """-resample-mm: Resample image to new resolution 6404 6405 Syntax: `-resample-mm <voxel_size> ` 6406 6407 Resamples the image as in **-resample**, but the user specifies the new 6408 voxel size rather than dimensions. This may not be precise, so the bounding 6409 box of the image may change. A warning will be generated in that case. 6410 6411 c3d img1.img -resample-mm 1.0x1.5x1.5mm -o img2.img""" 6412 6413 def run( 6414 self, 6415 execution: Execution, 6416 ) -> list[str]: 6417 """ 6418 Build command line arguments. This method is called by the main command. 6419 6420 Args: 6421 execution: The execution object. 6422 Returns: 6423 Command line arguments 6424 """ 6425 cargs = [] 6426 cargs.extend([ 6427 "-resample-mm", 6428 self.resample_mm 6429 ]) 6430 return cargs 6431 6432 6433@dataclasses.dataclass 6434class C3dResliceItk: 6435 """ 6436 -reslice-itk: Resample image using affine transform 6437 6438 Syntax: `-reslice-itk <transform_file> ` 6439 6440 Applies affine (or other) transform in ITK (ANTs) format to an image. See 6441 notes to **-reslice-matrix** for usage. 6442 """ 6443 reslice_itk: str 6444 """-reslice-itk: Resample image using affine transform 6445 6446 Syntax: `-reslice-itk <transform_file> ` 6447 6448 Applies affine (or other) transform in ITK (ANTs) format to an image. See 6449 notes to **-reslice-matrix** for usage.""" 6450 6451 def run( 6452 self, 6453 execution: Execution, 6454 ) -> list[str]: 6455 """ 6456 Build command line arguments. This method is called by the main command. 6457 6458 Args: 6459 execution: The execution object. 6460 Returns: 6461 Command line arguments 6462 """ 6463 cargs = [] 6464 cargs.extend([ 6465 "-reslice-itk", 6466 self.reslice_itk 6467 ]) 6468 return cargs 6469 6470 6471@dataclasses.dataclass 6472class C3dResliceMatrix: 6473 """ 6474 No description found. 6475 """ 6476 reslice_matrix: str 6477 """No description found.""" 6478 6479 def run( 6480 self, 6481 execution: Execution, 6482 ) -> list[str]: 6483 """ 6484 Build command line arguments. This method is called by the main command. 6485 6486 Args: 6487 execution: The execution object. 6488 Returns: 6489 Command line arguments 6490 """ 6491 cargs = [] 6492 cargs.extend([ 6493 "-reslice-matrix", 6494 self.reslice_matrix 6495 ]) 6496 return cargs 6497 6498 6499@dataclasses.dataclass 6500class C3dResliceIdentity: 6501 """ 6502 -reslice-identity: Resample image using identity transform 6503 6504 Syntax: `-reslice-identity ` 6505 6506 Applies the **-reslice-matrix** command with the identity transform. This is 6507 useful when you have two scans of the same subject with different coordinate 6508 transformations to patient space and you want to resample one scan in the 6509 space of another scan. For example, if you have T1 and T2 images in 6510 different coordinate frames, and want to reslice the T2 image into the space 6511 of the T1 6512 6513 c3d t1.nii t2.nii -reslice-identity -o t2_in_t1_space.nii. 6514 """ 6515 reslice_identity: str 6516 """-reslice-identity: Resample image using identity transform 6517 6518 Syntax: `-reslice-identity ` 6519 6520 Applies the **-reslice-matrix** command with the identity transform. This is 6521 useful when you have two scans of the same subject with different coordinate 6522 transformations to patient space and you want to resample one scan in the 6523 space of another scan. For example, if you have T1 and T2 images in 6524 different coordinate frames, and want to reslice the T2 image into the space 6525 of the T1 6526 6527 c3d t1.nii t2.nii -reslice-identity -o t2_in_t1_space.nii""" 6528 6529 def run( 6530 self, 6531 execution: Execution, 6532 ) -> list[str]: 6533 """ 6534 Build command line arguments. This method is called by the main command. 6535 6536 Args: 6537 execution: The execution object. 6538 Returns: 6539 Command line arguments 6540 """ 6541 cargs = [] 6542 cargs.extend([ 6543 "-reslice-identity", 6544 self.reslice_identity 6545 ]) 6546 return cargs 6547 6548 6549@dataclasses.dataclass 6550class C3dRgb2hsv: 6551 """ 6552 -rgb2hsv: Convert RGB image to HSV image 6553 6554 Syntax `-rgb2hsv` 6555 6556 Takes the last three images on the stack and treats them as red, green, and 6557 blue channels. Outputs three images corresponding to hue, saturation, value. 6558 To read color images you need the ***-msc*** command. 6559 6560 c3d -mcs color.png -rgb2hsv -omc hsv.png. 6561 """ 6562 rgb2hsv: str 6563 """-rgb2hsv: Convert RGB image to HSV image 6564 6565 Syntax `-rgb2hsv` 6566 6567 Takes the last three images on the stack and treats them as red, green, and 6568 blue channels. Outputs three images corresponding to hue, saturation, value. 6569 To read color images you need the ***-msc*** command. 6570 6571 c3d -mcs color.png -rgb2hsv -omc hsv.png""" 6572 6573 def run( 6574 self, 6575 execution: Execution, 6576 ) -> list[str]: 6577 """ 6578 Build command line arguments. This method is called by the main command. 6579 6580 Args: 6581 execution: The execution object. 6582 Returns: 6583 Command line arguments 6584 """ 6585 cargs = [] 6586 cargs.extend([ 6587 "-rgb2hsv", 6588 self.rgb2hsv 6589 ]) 6590 return cargs 6591 6592 6593@dataclasses.dataclass 6594class C3dRms: 6595 """ 6596 -rms: Voxelwise vector norm 6597 6598 Syntax: `-rms` 6599 6600 Computes RMS (root mean square) of all images on the stack. The command 6601 takes the square of each image on the stack, adds all the squared images and 6602 takes the square root of the result. This is very useful for statistical 6603 operations. Images must have the same size. 6604 6605 c3d img1.img img2.img img3.img img4.img -rms -o rms.img 6606 6607 The equivalent of this command is 6608 6609 c3d img1.img img2.img img3.img img4.img -foreach -dup -times -endfor \ 6610 -accum -add -endaccum -sqrt -o rms.img. 6611 """ 6612 rms: str 6613 """-rms: Voxelwise vector norm 6614 6615 Syntax: `-rms` 6616 6617 Computes RMS (root mean square) of all images on the stack. The command 6618 takes the square of each image on the stack, adds all the squared images and 6619 takes the square root of the result. This is very useful for statistical 6620 operations. Images must have the same size. 6621 6622 c3d img1.img img2.img img3.img img4.img -rms -o rms.img 6623 6624 The equivalent of this command is 6625 6626 c3d img1.img img2.img img3.img img4.img -foreach -dup -times -endfor \ 6627 -accum -add -endaccum -sqrt -o rms.img""" 6628 6629 def run( 6630 self, 6631 execution: Execution, 6632 ) -> list[str]: 6633 """ 6634 Build command line arguments. This method is called by the main command. 6635 6636 Args: 6637 execution: The execution object. 6638 Returns: 6639 Command line arguments 6640 """ 6641 cargs = [] 6642 cargs.extend([ 6643 "-rms", 6644 self.rms 6645 ]) 6646 return cargs 6647 6648 6649@dataclasses.dataclass 6650class C3dRound: 6651 """ 6652 -noround, -round: Floating point rounding behavior 6653 6654 Syntax: `-noround` or `-round ` 6655 6656 By default, **convert3d** will round floating point values when converting 6657 to an integer, short or byte image. This command specifies that rounding 6658 should not be used. Rounding is used to avoid numerical errors stemming from 6659 the internal floating point representation. 6660 6661 c3d image1.img -type short -noround image2.img. 6662 """ 6663 round_: str 6664 """-noround, -round: Floating point rounding behavior 6665 6666 Syntax: `-noround` or `-round ` 6667 6668 By default, **convert3d** will round floating point values when converting 6669 to an integer, short or byte image. This command specifies that rounding 6670 should not be used. Rounding is used to avoid numerical errors stemming from 6671 the internal floating point representation. 6672 6673 c3d image1.img -type short -noround image2.img""" 6674 6675 def run( 6676 self, 6677 execution: Execution, 6678 ) -> list[str]: 6679 """ 6680 Build command line arguments. This method is called by the main command. 6681 6682 Args: 6683 execution: The execution object. 6684 Returns: 6685 Command line arguments 6686 """ 6687 cargs = [] 6688 cargs.extend([ 6689 "-round", 6690 self.round_ 6691 ]) 6692 return cargs 6693 6694 6695@dataclasses.dataclass 6696class C3dScale: 6697 """ 6698 -scale: Scale intensity by constant factor 6699 6700 Syntax: `-scale <factor>` 6701 6702 Multiplies the intensity of each voxel in the last image on the stack by the 6703 given factor. 6704 6705 c3d img1.img -scale 0.5 -o img2.img. 6706 """ 6707 scale: str 6708 """-scale: Scale intensity by constant factor 6709 6710 Syntax: `-scale <factor>` 6711 6712 Multiplies the intensity of each voxel in the last image on the stack by the 6713 given factor. 6714 6715 c3d img1.img -scale 0.5 -o img2.img""" 6716 6717 def run( 6718 self, 6719 execution: Execution, 6720 ) -> list[str]: 6721 """ 6722 Build command line arguments. This method is called by the main command. 6723 6724 Args: 6725 execution: The execution object. 6726 Returns: 6727 Command line arguments 6728 """ 6729 cargs = [] 6730 cargs.extend([ 6731 "-scale", 6732 self.scale 6733 ]) 6734 return cargs 6735 6736 6737@dataclasses.dataclass 6738class C3dSetSform_: 6739 """ 6740 -set-sform: Set the transform to physical space 6741 6742 Syntax: `-set-sform <sform.mat> ` 6743 6744 Sets the Nifti sform of the last image on the stack to the 4x4 matrix 6745 provided. 6746 """ 6747 set_sform: str 6748 """-set-sform: Set the transform to physical space 6749 6750 Syntax: `-set-sform <sform.mat> ` 6751 6752 Sets the Nifti sform of the last image on the stack to the 4x4 matrix 6753 provided.""" 6754 6755 def run( 6756 self, 6757 execution: Execution, 6758 ) -> list[str]: 6759 """ 6760 Build command line arguments. This method is called by the main command. 6761 6762 Args: 6763 execution: The execution object. 6764 Returns: 6765 Command line arguments 6766 """ 6767 cargs = [] 6768 cargs.extend([ 6769 "-set-sform", 6770 self.set_sform 6771 ]) 6772 return cargs 6773 6774 6775@dataclasses.dataclass 6776class C3dSin: 6777 """ 6778 -cos: Voxelwise cosine 6779 6780 Syntax: `-sin` 6781 6782 Replaces the last image on the stack with the cosine trigonometric operation 6783 applied to all voxels. Input must be in radians. 6784 """ 6785 sin: str 6786 """-cos: Voxelwise cosine 6787 6788 Syntax: `-sin` 6789 6790 Replaces the last image on the stack with the cosine trigonometric operation 6791 applied to all voxels. Input must be in radians.""" 6792 6793 def run( 6794 self, 6795 execution: Execution, 6796 ) -> list[str]: 6797 """ 6798 Build command line arguments. This method is called by the main command. 6799 6800 Args: 6801 execution: The execution object. 6802 Returns: 6803 Command line arguments 6804 """ 6805 cargs = [] 6806 cargs.extend([ 6807 "-sin", 6808 self.sin 6809 ]) 6810 return cargs 6811 6812 6813@dataclasses.dataclass 6814class C3dSlice: 6815 """ 6816 -slice: Extract slices from an image 6817 6818 Syntax: `-slice axis position_spec` 6819 6820 Extracts a slice along the specified axis (x,y or z). The position specifier 6821 **position_spec** can be a single slice or a range of slices. For a single 6822 slice, it can be specified as a number or a percentage. Numbering is 6823 zero-based, i.e, the first slice is slice 0, the last slice is N-1, where N 6824 is the number of slices. For a range, use MATLAB notation first:step:last. 6825 The slice is placed on the stack as an image with size 1 in the last 6826 dimension. You can save the slice as a 2D PNG image. 6827 6828 c3d input.img -slice x 128 -o myslice.nii.gz 6829 c3d input.img -slice y 50% myslice.nii.gz 6830 c3d input.img -slice z 25% -type uchar -stretch 0 2000 0 255 -o myslice.png 6831 c3d input.img -slice z 0:-1 -oo slice%0d.nii.gz 6832 c3d input.img -slice z 20%:10%:80% -oo slice%0d.nii.gz 6833 6834 With the new command **c4d**, the **-slice** command can be used to extract 6835 volumes from a 4D image. This can be useful to reformat a 4D NIFTI image as 6836 a 3D multi-component NIFTI image, using the command 6837 6838 c4d input4d.nii.gz -slice w 0:-1 -omc output3d_multicomp.nii.gz. 6839 """ 6840 slice_: str 6841 """-slice: Extract slices from an image 6842 6843 Syntax: `-slice axis position_spec` 6844 6845 Extracts a slice along the specified axis (x,y or z). The position specifier 6846 **position_spec** can be a single slice or a range of slices. For a single 6847 slice, it can be specified as a number or a percentage. Numbering is 6848 zero-based, i.e, the first slice is slice 0, the last slice is N-1, where N 6849 is the number of slices. For a range, use MATLAB notation first:step:last. 6850 The slice is placed on the stack as an image with size 1 in the last 6851 dimension. You can save the slice as a 2D PNG image. 6852 6853 c3d input.img -slice x 128 -o myslice.nii.gz 6854 c3d input.img -slice y 50% myslice.nii.gz 6855 c3d input.img -slice z 25% -type uchar -stretch 0 2000 0 255 -o myslice.png 6856 c3d input.img -slice z 0:-1 -oo slice%0d.nii.gz 6857 c3d input.img -slice z 20%:10%:80% -oo slice%0d.nii.gz 6858 6859 With the new command **c4d**, the **-slice** command can be used to extract 6860 volumes from a 4D image. This can be useful to reformat a 4D NIFTI image as 6861 a 3D multi-component NIFTI image, using the command 6862 6863 c4d input4d.nii.gz -slice w 0:-1 -omc output3d_multicomp.nii.gz""" 6864 6865 def run( 6866 self, 6867 execution: Execution, 6868 ) -> list[str]: 6869 """ 6870 Build command line arguments. This method is called by the main command. 6871 6872 Args: 6873 execution: The execution object. 6874 Returns: 6875 Command line arguments 6876 """ 6877 cargs = [] 6878 cargs.extend([ 6879 "-slice", 6880 self.slice_ 6881 ]) 6882 return cargs 6883 6884 6885@dataclasses.dataclass 6886class C3dSliceAll: 6887 """ 6888 -slice-all: Extract slices from all images on the stack 6889 6890 Syntax `-slice-all axis position_spec` 6891 6892 This command behaves identical to the **-slice** command, but all images on 6893 the stack are sliced, and the slices are interleaved. This is useful for 6894 slicing multi-component images. For example, if you read a four-component 6895 image 'test4.nii.gz', you can extract and save the slices as follows: 6896 6897 c3d test4.nii.gz -slice-all 20%:10%:80% -oomc 4 slice4_%03d.nii.gz. 6898 """ 6899 slice_all: str 6900 """-slice-all: Extract slices from all images on the stack 6901 6902 Syntax `-slice-all axis position_spec` 6903 6904 This command behaves identical to the **-slice** command, but all images on 6905 the stack are sliced, and the slices are interleaved. This is useful for 6906 slicing multi-component images. For example, if you read a four-component 6907 image 'test4.nii.gz', you can extract and save the slices as follows: 6908 6909 c3d test4.nii.gz -slice-all 20%:10%:80% -oomc 4 slice4_%03d.nii.gz""" 6910 6911 def run( 6912 self, 6913 execution: Execution, 6914 ) -> list[str]: 6915 """ 6916 Build command line arguments. This method is called by the main command. 6917 6918 Args: 6919 execution: The execution object. 6920 Returns: 6921 Command line arguments 6922 """ 6923 cargs = [] 6924 cargs.extend([ 6925 "-slice-all", 6926 self.slice_all 6927 ]) 6928 return cargs 6929 6930 6931@dataclasses.dataclass 6932class C3dSharpen: 6933 """ 6934 -sharpen: Sharpen edges in the image 6935 6936 Syntax: `-sharpen` 6937 6938 Applies the Laplacian sharpening filter from ITK, which accentuates the 6939 edges in the image. 6940 6941 c3d input.nii.gz -sharpen -o output.nii.gz. 6942 """ 6943 sharpen: str 6944 """-sharpen: Sharpen edges in the image 6945 6946 Syntax: `-sharpen` 6947 6948 Applies the Laplacian sharpening filter from ITK, which accentuates the 6949 edges in the image. 6950 6951 c3d input.nii.gz -sharpen -o output.nii.gz""" 6952 6953 def run( 6954 self, 6955 execution: Execution, 6956 ) -> list[str]: 6957 """ 6958 Build command line arguments. This method is called by the main command. 6959 6960 Args: 6961 execution: The execution object. 6962 Returns: 6963 Command line arguments 6964 """ 6965 cargs = [] 6966 cargs.extend([ 6967 "-sharpen", 6968 self.sharpen 6969 ]) 6970 return cargs 6971 6972 6973@dataclasses.dataclass 6974class C3dShift: 6975 """ 6976 -shift: Shift image intensity by constant 6977 6978 Syntax: `-shift <constant>` 6979 6980 Adds the given constant to every voxel. 6981 6982 c3d img1.img -shift 100 -o img2.img. 6983 """ 6984 shift: str 6985 """-shift: Shift image intensity by constant 6986 6987 Syntax: `-shift <constant>` 6988 6989 Adds the given constant to every voxel. 6990 6991 c3d img1.img -shift 100 -o img2.img""" 6992 6993 def run( 6994 self, 6995 execution: Execution, 6996 ) -> list[str]: 6997 """ 6998 Build command line arguments. This method is called by the main command. 6999 7000 Args: 7001 execution: The execution object. 7002 Returns: 7003 Command line arguments 7004 """ 7005 cargs = [] 7006 cargs.extend([ 7007 "-shift", 7008 self.shift 7009 ]) 7010 return cargs 7011 7012 7013@dataclasses.dataclass 7014class C3dSignedDistanceTransform: 7015 """ 7016 -sdt, -signed-distance-transform: Signed distance transform of a binary 7017 image 7018 7019 Syntax: `-sdt` 7020 7021 Computes the signed distance transform of a binary image. Voxels where the 7022 binary image is non-zero will have negative values and voxels where the 7023 binary image is zero will have negative values. The magnitude of the value 7024 will be the approximate Euclidean distance to the boundary of the object 7025 represented by the binary image. 7026 7027 c3d binary.img -sdt -o dist.img. 7028 """ 7029 signed_distance_transform: str 7030 """-sdt, -signed-distance-transform: Signed distance transform of a binary 7031 image 7032 7033 Syntax: `-sdt` 7034 7035 Computes the signed distance transform of a binary image. Voxels where the 7036 binary image is non-zero will have negative values and voxels where the 7037 binary image is zero will have negative values. The magnitude of the value 7038 will be the approximate Euclidean distance to the boundary of the object 7039 represented by the binary image. 7040 7041 c3d binary.img -sdt -o dist.img""" 7042 7043 def run( 7044 self, 7045 execution: Execution, 7046 ) -> list[str]: 7047 """ 7048 Build command line arguments. This method is called by the main command. 7049 7050 Args: 7051 execution: The execution object. 7052 Returns: 7053 Command line arguments 7054 """ 7055 cargs = [] 7056 cargs.extend([ 7057 "-signed-distance-transform", 7058 self.signed_distance_transform 7059 ]) 7060 return cargs 7061 7062 7063@dataclasses.dataclass 7064class C3dSmooth: 7065 """ 7066 -smooth: Gaussian smoothing 7067 7068 Syntax: `-smooth <sigma_vector> ` 7069 7070 Applies Gaussian smoothing to the image. The parameter vector specifies the 7071 standard deviation of the Gaussian kernel. Also see [Vector Format 7072 Specification][10] below. 7073 7074 c3d img1.img -smooth 2x1x1vox -o out.img. 7075 """ 7076 smooth: str 7077 """-smooth: Gaussian smoothing 7078 7079 Syntax: `-smooth <sigma_vector> ` 7080 7081 Applies Gaussian smoothing to the image. The parameter vector specifies the 7082 standard deviation of the Gaussian kernel. Also see [Vector Format 7083 Specification][10] below. 7084 7085 c3d img1.img -smooth 2x1x1vox -o out.img""" 7086 7087 def run( 7088 self, 7089 execution: Execution, 7090 ) -> list[str]: 7091 """ 7092 Build command line arguments. This method is called by the main command. 7093 7094 Args: 7095 execution: The execution object. 7096 Returns: 7097 Command line arguments 7098 """ 7099 cargs = [] 7100 cargs.extend([ 7101 "-smooth", 7102 self.smooth 7103 ]) 7104 return cargs 7105 7106 7107@dataclasses.dataclass 7108class C3dSmoothFast: 7109 """ 7110 -smooth-fast: Fast approximate Gaussian smoothing 7111 7112 Syntax: `-smooth-fast <sigma_vector> ` 7113 7114 Applies Gaussian smoothing to the image using the fast [Deriche recursive 7115 smoothing algorithm][15]. The parameter vector specifies the standard 7116 deviation of the Gaussian kernel. Also see [Vector Format Specification][10] 7117 below. 7118 7119 c3d img1.img -smooth-fast 20x10x10vox -o out.img. 7120 """ 7121 smooth_fast: str 7122 """-smooth-fast: Fast approximate Gaussian smoothing 7123 7124 Syntax: `-smooth-fast <sigma_vector> ` 7125 7126 Applies Gaussian smoothing to the image using the fast [Deriche recursive 7127 smoothing algorithm][15]. The parameter vector specifies the standard 7128 deviation of the Gaussian kernel. Also see [Vector Format Specification][10] 7129 below. 7130 7131 c3d img1.img -smooth-fast 20x10x10vox -o out.img""" 7132 7133 def run( 7134 self, 7135 execution: Execution, 7136 ) -> list[str]: 7137 """ 7138 Build command line arguments. This method is called by the main command. 7139 7140 Args: 7141 execution: The execution object. 7142 Returns: 7143 Command line arguments 7144 """ 7145 cargs = [] 7146 cargs.extend([ 7147 "-smooth-fast", 7148 self.smooth_fast 7149 ]) 7150 return cargs 7151 7152 7153@dataclasses.dataclass 7154class C3dSpacing: 7155 """ 7156 -spacing: Set voxel spacing 7157 7158 Syntax: `-spacing <vector> ` 7159 7160 Sets the voxel spacing of the image. This should always be a vector with 7161 positive components. For example, to set the spacing of the image to 1mm 7162 isotropic, use the command below. This command only changes the header of 7163 the image, not its contents. 7164 7165 c3d img.nii -spacing 1x1x1mm -o out.img. 7166 """ 7167 spacing: str 7168 """-spacing: Set voxel spacing 7169 7170 Syntax: `-spacing <vector> ` 7171 7172 Sets the voxel spacing of the image. This should always be a vector with 7173 positive components. For example, to set the spacing of the image to 1mm 7174 isotropic, use the command below. This command only changes the header of 7175 the image, not its contents. 7176 7177 c3d img.nii -spacing 1x1x1mm -o out.img""" 7178 7179 def run( 7180 self, 7181 execution: Execution, 7182 ) -> list[str]: 7183 """ 7184 Build command line arguments. This method is called by the main command. 7185 7186 Args: 7187 execution: The execution object. 7188 Returns: 7189 Command line arguments 7190 """ 7191 cargs = [] 7192 cargs.extend([ 7193 "-spacing", 7194 self.spacing 7195 ]) 7196 return cargs 7197 7198 7199@dataclasses.dataclass 7200class C3dSplit: 7201 """ 7202 -split: Split multi-label image into binary images 7203 7204 Syntax: `-split` 7205 7206 This command takes a multilabel image (one with a small number of discrete 7207 intensity levels), and replaces it with a set of binary images, one for each 7208 of the levels. The images can later be recombined using the **-merge** 7209 command. The labels corresponding to each binary image are remembered by 7210 **convert3d** so that when **-merge** is called, the labels are faithfully 7211 reassigned. The **-merge** command treats each input as a probability image, 7212 and selects at each voxel the label that has highest probability. The 7213 example below smooths each label independently, then recombines using 7214 **-merge** 7215 7216 c3d multilabel.nii -split -foreach -smooth 3mm -endfor -merge -o 7217 ml_smooth.nii 7218 7219 Also of note is that the **-split** command will disregard infinite 7220 intensity values. So if you want to apply voting to a subset of the labels, 7221 you can replace labels you do not care about with *inf*, for example, using 7222 the **-thresh** command. 7223 """ 7224 split: str 7225 """-split: Split multi-label image into binary images 7226 7227 Syntax: `-split` 7228 7229 This command takes a multilabel image (one with a small number of discrete 7230 intensity levels), and replaces it with a set of binary images, one for each 7231 of the levels. The images can later be recombined using the **-merge** 7232 command. The labels corresponding to each binary image are remembered by 7233 **convert3d** so that when **-merge** is called, the labels are faithfully 7234 reassigned. The **-merge** command treats each input as a probability image, 7235 and selects at each voxel the label that has highest probability. The 7236 example below smooths each label independently, then recombines using 7237 **-merge** 7238 7239 c3d multilabel.nii -split -foreach -smooth 3mm -endfor -merge -o 7240 ml_smooth.nii 7241 7242 Also of note is that the **-split** command will disregard infinite 7243 intensity values. So if you want to apply voting to a subset of the labels, 7244 you can replace labels you do not care about with *inf*, for example, using 7245 the **-thresh** command.""" 7246 7247 def run( 7248 self, 7249 execution: Execution, 7250 ) -> list[str]: 7251 """ 7252 Build command line arguments. This method is called by the main command. 7253 7254 Args: 7255 execution: The execution object. 7256 Returns: 7257 Command line arguments 7258 """ 7259 cargs = [] 7260 cargs.extend([ 7261 "-split", 7262 self.split 7263 ]) 7264 return cargs 7265 7266 7267@dataclasses.dataclass 7268class C3dSqrt: 7269 """ 7270 -sqrt: Take square root of image 7271 7272 Syntax: `-sqrt ` 7273 7274 Computes square root of each voxel in the image. 7275 7276 c3d input.img -sqrt -o output.img. 7277 """ 7278 sqrt: str 7279 """-sqrt: Take square root of image 7280 7281 Syntax: `-sqrt ` 7282 7283 Computes square root of each voxel in the image. 7284 7285 c3d input.img -sqrt -o output.img""" 7286 7287 def run( 7288 self, 7289 execution: Execution, 7290 ) -> list[str]: 7291 """ 7292 Build command line arguments. This method is called by the main command. 7293 7294 Args: 7295 execution: The execution object. 7296 Returns: 7297 Command line arguments 7298 """ 7299 cargs = [] 7300 cargs.extend([ 7301 "-sqrt", 7302 self.sqrt 7303 ]) 7304 return cargs 7305 7306 7307@dataclasses.dataclass 7308class C3dStaple: 7309 """ 7310 -staple: STAPLE algorithm to combine segmentations 7311 7312 Syntax: `-staple <intensity_value> ` 7313 7314 Runs the ITK implementation of the STAPLE algorithm ([See Paper][11]). 7315 STAPLE generates an estimate of the 'true' segmentation of a structure given 7316 a set of segmentations by different raters. This command treats all images 7317 on the stack as inputs. Each image is considered to be a segmentation by a 7318 different rater. The parameter *intensity_value* specifies the label in the 7319 segmentation images corresponding to the structure of interest (e.g., the 7320 segmentation image may have value 1 corresponding to the caudate and value 2 7321 corresponding to the hippocampus. To run STAPLE on the hippocampus, pass in 7322 2 as the *intensity_value*). The output of STAPLE is a real-valued image 7323 with voxels between 0 and 1, representing the probability of each voxel 7324 being in the 'true' segmentation. This image can be thresholded to get a 7325 binary consensus segmentation. Additional outputs (estimates of the 7326 sensitivity and specificity of each rater) are printed out if the 7327 **-verbose** command is used before the **-staple** command. 7328 7329 c3d -verbose rater1.img rater2.img rater3.img -staple 1 -o probmap.img 7330 c3d -verbose rater*.img -staple 1 -threshold 0.5 inf 1 0 -o bin_segm.img. 7331 """ 7332 staple: str 7333 """-staple: STAPLE algorithm to combine segmentations 7334 7335 Syntax: `-staple <intensity_value> ` 7336 7337 Runs the ITK implementation of the STAPLE algorithm ([See Paper][11]). 7338 STAPLE generates an estimate of the 'true' segmentation of a structure given 7339 a set of segmentations by different raters. This command treats all images 7340 on the stack as inputs. Each image is considered to be a segmentation by a 7341 different rater. The parameter *intensity_value* specifies the label in the 7342 segmentation images corresponding to the structure of interest (e.g., the 7343 segmentation image may have value 1 corresponding to the caudate and value 2 7344 corresponding to the hippocampus. To run STAPLE on the hippocampus, pass in 7345 2 as the *intensity_value*). The output of STAPLE is a real-valued image 7346 with voxels between 0 and 1, representing the probability of each voxel 7347 being in the 'true' segmentation. This image can be thresholded to get a 7348 binary consensus segmentation. Additional outputs (estimates of the 7349 sensitivity and specificity of each rater) are printed out if the 7350 **-verbose** command is used before the **-staple** command. 7351 7352 c3d -verbose rater1.img rater2.img rater3.img -staple 1 -o probmap.img 7353 c3d -verbose rater*.img -staple 1 -threshold 0.5 inf 1 0 -o bin_segm.img""" 7354 7355 def run( 7356 self, 7357 execution: Execution, 7358 ) -> list[str]: 7359 """ 7360 Build command line arguments. This method is called by the main command. 7361 7362 Args: 7363 execution: The execution object. 7364 Returns: 7365 Command line arguments 7366 """ 7367 cargs = [] 7368 cargs.extend([ 7369 "-staple", 7370 self.staple 7371 ]) 7372 return cargs 7373 7374 7375@dataclasses.dataclass 7376class C3dStructureTensorEigenvalues: 7377 """ 7378 -steig, -structure-tensor-eigenvalues: Compute eigenvalues of the structure 7379 tensor 7380 7381 Syntax `-steig <scale> <radius>` 7382 7383 Computes the Hessian matrix at every pixel of an image and the eigenvalues 7384 of the Hessian. Images of the eigenvalues (sorted by value) are placed on 7385 the stack. These images are useful as texture features. See also the 7386 '''-steig''' command. The scale determines the amount of Gaussian smoothing 7387 applied for computing the partial derivatives in the Hessian, and is in 7388 physical (mm) units. 7389 7390 c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz. 7391 """ 7392 structure_tensor_eigenvalues: str 7393 """-steig, -structure-tensor-eigenvalues: Compute eigenvalues of the 7394 structure tensor 7395 7396 Syntax `-steig <scale> <radius>` 7397 7398 Computes the Hessian matrix at every pixel of an image and the eigenvalues 7399 of the Hessian. Images of the eigenvalues (sorted by value) are placed on 7400 the stack. These images are useful as texture features. See also the 7401 '''-steig''' command. The scale determines the amount of Gaussian smoothing 7402 applied for computing the partial derivatives in the Hessian, and is in 7403 physical (mm) units. 7404 7405 c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz""" 7406 7407 def run( 7408 self, 7409 execution: Execution, 7410 ) -> list[str]: 7411 """ 7412 Build command line arguments. This method is called by the main command. 7413 7414 Args: 7415 execution: The execution object. 7416 Returns: 7417 Command line arguments 7418 """ 7419 cargs = [] 7420 cargs.extend([ 7421 "-steig", 7422 self.structure_tensor_eigenvalues 7423 ]) 7424 return cargs 7425 7426 7427@dataclasses.dataclass 7428class C3dSpm: 7429 """ 7430 -spm, -nospm: SPM compatibility in Analyze output 7431 7432 Syntax: `-spm` or `-nospm ` 7433 7434 These options specify whether use the SPM extension to the Analyze 7435 (.hdr,.img) format. When this option is on, the origin field stored by SPM 7436 in the Analyze header will be correctly interpreted. When saving analyze 7437 files, the origin will be set correctly. The default is equivalent to the 7438 **-nospm** option. Best to avoid this issue altogether by using NIFTI and 7439 SPM5 or later. 7440 7441 c3d -spm in.hdr out.img.gz. 7442 """ 7443 spm: str 7444 """-spm, -nospm: SPM compatibility in Analyze output 7445 7446 Syntax: `-spm` or `-nospm ` 7447 7448 These options specify whether use the SPM extension to the Analyze 7449 (.hdr,.img) format. When this option is on, the origin field stored by SPM 7450 in the Analyze header will be correctly interpreted. When saving analyze 7451 files, the origin will be set correctly. The default is equivalent to the 7452 **-nospm** option. Best to avoid this issue altogether by using NIFTI and 7453 SPM5 or later. 7454 7455 c3d -spm in.hdr out.img.gz""" 7456 7457 def run( 7458 self, 7459 execution: Execution, 7460 ) -> list[str]: 7461 """ 7462 Build command line arguments. This method is called by the main command. 7463 7464 Args: 7465 execution: The execution object. 7466 Returns: 7467 Command line arguments 7468 """ 7469 cargs = [] 7470 cargs.extend([ 7471 "-spm", 7472 self.spm 7473 ]) 7474 return cargs 7475 7476 7477@dataclasses.dataclass 7478class C3dSubtract: 7479 """ 7480 No description found. 7481 """ 7482 subtract: str 7483 """No description found.""" 7484 7485 def run( 7486 self, 7487 execution: Execution, 7488 ) -> list[str]: 7489 """ 7490 Build command line arguments. This method is called by the main command. 7491 7492 Args: 7493 execution: The execution object. 7494 Returns: 7495 Command line arguments 7496 """ 7497 cargs = [] 7498 cargs.extend([ 7499 "-subtract", 7500 self.subtract 7501 ]) 7502 return cargs 7503 7504 7505@dataclasses.dataclass 7506class C3dSupervoxel: 7507 """ 7508 No description found. 7509 """ 7510 supervoxel: str 7511 """No description found.""" 7512 7513 def run( 7514 self, 7515 execution: Execution, 7516 ) -> list[str]: 7517 """ 7518 Build command line arguments. This method is called by the main command. 7519 7520 Args: 7521 execution: The execution object. 7522 Returns: 7523 Command line arguments 7524 """ 7525 cargs = [] 7526 cargs.extend([ 7527 "-supervoxel", 7528 self.supervoxel 7529 ]) 7530 return cargs 7531 7532 7533@dataclasses.dataclass 7534class C3dStretch: 7535 """ 7536 -stretch: Stretch image intensities linearly 7537 7538 Syntax: `-stretch <u1 u2 v1 v2> ` 7539 7540 Stretches the intensities in the image linearly, such that u1 maps to v1 and 7541 u2 maps to v2. The linear transformation is applied to all intensities in 7542 the image, whether inside the range or not. For example, to map a floating 7543 point image with intensities in interval (0,1) to the full range of an 7544 unsigned short image, use 7545 7546 c3d input.img -stretch 0.0 1.0 0 65535 -type ushort -o output.img. 7547 """ 7548 stretch: str 7549 """-stretch: Stretch image intensities linearly 7550 7551 Syntax: `-stretch <u1 u2 v1 v2> ` 7552 7553 Stretches the intensities in the image linearly, such that u1 maps to v1 and 7554 u2 maps to v2. The linear transformation is applied to all intensities in 7555 the image, whether inside the range or not. For example, to map a floating 7556 point image with intensities in interval (0,1) to the full range of an 7557 unsigned short image, use 7558 7559 c3d input.img -stretch 0.0 1.0 0 65535 -type ushort -o output.img""" 7560 7561 def run( 7562 self, 7563 execution: Execution, 7564 ) -> list[str]: 7565 """ 7566 Build command line arguments. This method is called by the main command. 7567 7568 Args: 7569 execution: The execution object. 7570 Returns: 7571 Command line arguments 7572 """ 7573 cargs = [] 7574 cargs.extend([ 7575 "-stretch", 7576 self.stretch 7577 ]) 7578 return cargs 7579 7580 7581@dataclasses.dataclass 7582class C3dSwapdim: 7583 """ 7584 -swapdim: Reorder the coordinate axes of an image 7585 7586 Syntax `-swapdim <code>` 7587 7588 This command reorders the image axes (columns, rows, slices) to achieve a 7589 desired transformation between voxel space and physical space. The image 7590 remains exactly the same in physical space, but the encoding of the voxels 7591 in memory and on disk is changed to obtain the desired transformation. The 7592 transformation is specified as a three-letter 'RAI' code, as in the 7593 '''-orient''' command. 7594 7595 c3d img.nii -swapdim ASL -info -o out.nii 7596 7597 7598 ### Commands: Image Processing 7599 7600 The following commands invoke an action that is applied to images. Unary 7601 commands apply the action to the last image on the stack, binary commands 7602 apply to the last two images and so on. Commands are affected by options, 7603 which are listed separately. 7604 """ 7605 swapdim: str 7606 """-swapdim: Reorder the coordinate axes of an image 7607 7608 Syntax `-swapdim <code>` 7609 7610 This command reorders the image axes (columns, rows, slices) to achieve a 7611 desired transformation between voxel space and physical space. The image 7612 remains exactly the same in physical space, but the encoding of the voxels 7613 in memory and on disk is changed to obtain the desired transformation. The 7614 transformation is specified as a three-letter 'RAI' code, as in the 7615 '''-orient''' command. 7616 7617 c3d img.nii -swapdim ASL -info -o out.nii 7618 7619 7620 ### Commands: Image Processing 7621 7622 The following commands invoke an action that is applied to images. Unary 7623 commands apply the action to the last image on the stack, binary commands 7624 apply to the last two images and so on. Commands are affected by options, 7625 which are listed separately.""" 7626 7627 def run( 7628 self, 7629 execution: Execution, 7630 ) -> list[str]: 7631 """ 7632 Build command line arguments. This method is called by the main command. 7633 7634 Args: 7635 execution: The execution object. 7636 Returns: 7637 Command line arguments 7638 """ 7639 cargs = [] 7640 cargs.extend([ 7641 "-swapdim", 7642 self.swapdim 7643 ]) 7644 return cargs 7645 7646 7647@dataclasses.dataclass 7648class C3dTestImage: 7649 """ 7650 -test-image, -test-probe: Test condition 7651 7652 Syntax: `-test-image [tolerance]` and `-test-probe <vector> <value> 7653 [tolerance]` 7654 7655 These advanced commands (with more to come in the future) are primarily 7656 meant to allow testing of **c3d**. However, they can also be used for flow 7657 control in shell scripts (e.g., **bash** shell). The commands check a 7658 certain aspect of the **c3d** state and cause the program to exit with 7659 either return code 0 if the test succeeded or a non-zero return code if the 7660 test failed. 7661 7662 **-test-image** tests if the last two images on the stack are identical 7663 (both in terms of data and header). Returns 0 if the images are identical. 7664 The optional tolerance parameter has default value 1e-8. 7665 7666 c3d input1.img input2.img -test-image 7667 7668 **-test-probe** is similar to the **-probe** command. It tests if the value 7669 of the last image on the stack at the position given by **vector** is equal 7670 to the **test_value**. An optional tolerance value may be specified, the 7671 default is 1e-8. 7672 7673 c3d input1.img -test-probe 40x40x20vox 1.0 1e-6. 7674 """ 7675 test_image: str 7676 """-test-image, -test-probe: Test condition 7677 7678 Syntax: `-test-image [tolerance]` and `-test-probe <vector> <value> 7679 [tolerance]` 7680 7681 These advanced commands (with more to come in the future) are primarily 7682 meant to allow testing of **c3d**. However, they can also be used for flow 7683 control in shell scripts (e.g., **bash** shell). The commands check a 7684 certain aspect of the **c3d** state and cause the program to exit with 7685 either return code 0 if the test succeeded or a non-zero return code if the 7686 test failed. 7687 7688 **-test-image** tests if the last two images on the stack are identical 7689 (both in terms of data and header). Returns 0 if the images are identical. 7690 The optional tolerance parameter has default value 1e-8. 7691 7692 c3d input1.img input2.img -test-image 7693 7694 **-test-probe** is similar to the **-probe** command. It tests if the value 7695 of the last image on the stack at the position given by **vector** is equal 7696 to the **test_value**. An optional tolerance value may be specified, the 7697 default is 1e-8. 7698 7699 c3d input1.img -test-probe 40x40x20vox 1.0 1e-6""" 7700 7701 def run( 7702 self, 7703 execution: Execution, 7704 ) -> list[str]: 7705 """ 7706 Build command line arguments. This method is called by the main command. 7707 7708 Args: 7709 execution: The execution object. 7710 Returns: 7711 Command line arguments 7712 """ 7713 cargs = [] 7714 cargs.extend([ 7715 "-test-image", 7716 self.test_image 7717 ]) 7718 return cargs 7719 7720 7721@dataclasses.dataclass 7722class C3dTestProbe: 7723 """ 7724 -test-image, -test-probe: Test condition 7725 7726 Syntax: `-test-image [tolerance]` and `-test-probe <vector> <value> 7727 [tolerance]` 7728 7729 These advanced commands (with more to come in the future) are primarily 7730 meant to allow testing of **c3d**. However, they can also be used for flow 7731 control in shell scripts (e.g., **bash** shell). The commands check a 7732 certain aspect of the **c3d** state and cause the program to exit with 7733 either return code 0 if the test succeeded or a non-zero return code if the 7734 test failed. 7735 7736 **-test-image** tests if the last two images on the stack are identical 7737 (both in terms of data and header). Returns 0 if the images are identical. 7738 The optional tolerance parameter has default value 1e-8. 7739 7740 c3d input1.img input2.img -test-image 7741 7742 **-test-probe** is similar to the **-probe** command. It tests if the value 7743 of the last image on the stack at the position given by **vector** is equal 7744 to the **test_value**. An optional tolerance value may be specified, the 7745 default is 1e-8. 7746 7747 c3d input1.img -test-probe 40x40x20vox 1.0 1e-6. 7748 """ 7749 test_probe: str 7750 """-test-image, -test-probe: Test condition 7751 7752 Syntax: `-test-image [tolerance]` and `-test-probe <vector> <value> 7753 [tolerance]` 7754 7755 These advanced commands (with more to come in the future) are primarily 7756 meant to allow testing of **c3d**. However, they can also be used for flow 7757 control in shell scripts (e.g., **bash** shell). The commands check a 7758 certain aspect of the **c3d** state and cause the program to exit with 7759 either return code 0 if the test succeeded or a non-zero return code if the 7760 test failed. 7761 7762 **-test-image** tests if the last two images on the stack are identical 7763 (both in terms of data and header). Returns 0 if the images are identical. 7764 The optional tolerance parameter has default value 1e-8. 7765 7766 c3d input1.img input2.img -test-image 7767 7768 **-test-probe** is similar to the **-probe** command. It tests if the value 7769 of the last image on the stack at the position given by **vector** is equal 7770 to the **test_value**. An optional tolerance value may be specified, the 7771 default is 1e-8. 7772 7773 c3d input1.img -test-probe 40x40x20vox 1.0 1e-6""" 7774 7775 def run( 7776 self, 7777 execution: Execution, 7778 ) -> list[str]: 7779 """ 7780 Build command line arguments. This method is called by the main command. 7781 7782 Args: 7783 execution: The execution object. 7784 Returns: 7785 Command line arguments 7786 """ 7787 cargs = [] 7788 cargs.extend([ 7789 "-test-probe", 7790 self.test_probe 7791 ]) 7792 return cargs 7793 7794 7795@dataclasses.dataclass 7796class C3dThreshold: 7797 """ 7798 -thresh, -threshold: Binary thresholding 7799 7800 Syntax: `-thresh <u1 u2 vIn vOut> ` 7801 7802 Thresholds the image, setting voxels whose intensity is in the range [u1,u2] 7803 to vIn and all other voxels to vOut. Values *u1* and *u2* are intensity 7804 specifications (see below). This means that you can supply values **inf** 7805 and **-inf** for u1 and u2 to construct a one-sided threshold. You can also 7806 specify *u1* and *u2* as percentiles. 7807 c3d in.img -threshold -inf 128 1 0 -o out.img 7808 c3d in.img -threshold 64 128 1 0 -o out.img 7809 c3d in.img -threshold 20% 40% 1 0 -o out.img. 7810 """ 7811 threshold: str 7812 """-thresh, -threshold: Binary thresholding 7813 7814 Syntax: `-thresh <u1 u2 vIn vOut> ` 7815 7816 Thresholds the image, setting voxels whose intensity is in the range [u1,u2] 7817 to vIn and all other voxels to vOut. Values *u1* and *u2* are intensity 7818 specifications (see below). This means that you can supply values **inf** 7819 and **-inf** for u1 and u2 to construct a one-sided threshold. You can also 7820 specify *u1* and *u2* as percentiles. 7821 c3d in.img -threshold -inf 128 1 0 -o out.img 7822 c3d in.img -threshold 64 128 1 0 -o out.img 7823 c3d in.img -threshold 20% 40% 1 0 -o out.img""" 7824 7825 def run( 7826 self, 7827 execution: Execution, 7828 ) -> list[str]: 7829 """ 7830 Build command line arguments. This method is called by the main command. 7831 7832 Args: 7833 execution: The execution object. 7834 Returns: 7835 Command line arguments 7836 """ 7837 cargs = [] 7838 cargs.extend([ 7839 "-threshold", 7840 self.threshold 7841 ]) 7842 return cargs 7843 7844 7845@dataclasses.dataclass 7846class C3dTile: 7847 """ 7848 -tile: Tile and stack multiple images into one 7849 7850 Syntax: `-tile <tile_spec>` 7851 7852 Tiles multiple images into a single image -- including stacking slices into 7853 a 3D volume. The command takes all images on the stack and produces a single 7854 tiled image. The **tile_spec** parameter can either specify a coordinate 7855 axis (x, y, or z) along which to tile the images, or a layout vector (e.g., 7856 **4x4**) which specifies the tiling along each coordinate. Passing 0 for the 7857 last value in the layout vector determines the value based on the number of 7858 images currently loaded. For example, to create a 3D volume from a set of 7859 slices, we use 7860 7861 c3d slices*.png -tile z -o volume.nii.gz 7862 7863 And to arrange the same 2D slices into a 2D montage of 4 images per row, we 7864 would use the **c2d** command as follows: 7865 7866 c2d slices*.png -tile 4x0 -type uchar -o montage.png. 7867 """ 7868 tile: str 7869 """-tile: Tile and stack multiple images into one 7870 7871 Syntax: `-tile <tile_spec>` 7872 7873 Tiles multiple images into a single image -- including stacking slices into 7874 a 3D volume. The command takes all images on the stack and produces a single 7875 tiled image. The **tile_spec** parameter can either specify a coordinate 7876 axis (x, y, or z) along which to tile the images, or a layout vector (e.g., 7877 **4x4**) which specifies the tiling along each coordinate. Passing 0 for the 7878 last value in the layout vector determines the value based on the number of 7879 images currently loaded. For example, to create a 3D volume from a set of 7880 slices, we use 7881 7882 c3d slices*.png -tile z -o volume.nii.gz 7883 7884 And to arrange the same 2D slices into a 2D montage of 4 images per row, we 7885 would use the **c2d** command as follows: 7886 7887 c2d slices*.png -tile 4x0 -type uchar -o montage.png""" 7888 7889 def run( 7890 self, 7891 execution: Execution, 7892 ) -> list[str]: 7893 """ 7894 Build command line arguments. This method is called by the main command. 7895 7896 Args: 7897 execution: The execution object. 7898 Returns: 7899 Command line arguments 7900 """ 7901 cargs = [] 7902 cargs.extend([ 7903 "-tile", 7904 self.tile 7905 ]) 7906 return cargs 7907 7908 7909@dataclasses.dataclass 7910class C3dTrim: 7911 """ 7912 -trim: Trim background region of image 7913 7914 Syntax: `-trim <margin_vector>` 7915 7916 Use this command to trim background in an image. When most of the image is 7917 filled by background, this command will find the smallest rectangular region 7918 that contains all of the non-background voxels in the image. I will then 7919 expand this region by the margin of the size specified, and return the 7920 resulting region as the new image. For example, this command will trim an 7921 image, leaving a 5-voxel margin of background values on all sides 7922 7923 c3d in.img -trim 5vox -o out.img. 7924 """ 7925 trim: str 7926 """-trim: Trim background region of image 7927 7928 Syntax: `-trim <margin_vector>` 7929 7930 Use this command to trim background in an image. When most of the image is 7931 filled by background, this command will find the smallest rectangular region 7932 that contains all of the non-background voxels in the image. I will then 7933 expand this region by the margin of the size specified, and return the 7934 resulting region as the new image. For example, this command will trim an 7935 image, leaving a 5-voxel margin of background values on all sides 7936 7937 c3d in.img -trim 5vox -o out.img""" 7938 7939 def run( 7940 self, 7941 execution: Execution, 7942 ) -> list[str]: 7943 """ 7944 Build command line arguments. This method is called by the main command. 7945 7946 Args: 7947 execution: The execution object. 7948 Returns: 7949 Command line arguments 7950 """ 7951 cargs = [] 7952 cargs.extend([ 7953 "-trim", 7954 self.trim 7955 ]) 7956 return cargs 7957 7958 7959@dataclasses.dataclass 7960class C3dTrimToSize: 7961 """ 7962 -trim-to-size: Trim image to given size 7963 7964 Syntax: `-trim-to-size <size_vector>` 7965 7966 Like **-trim**, this command trims the background in an image. However, 7967 instead of **-trim**, you specify the target size of the output region. The 7968 actual region may be smaller if the specified region falls outside the 7969 boundaries of the input image. For example, if you want a 64x64x128 image 7970 containing all the foreground pixels in your image, call 7971 7972 c3d in.img -trim-to-size 64x64x128vox -o out.img. 7973 """ 7974 trim_to_size: str 7975 """-trim-to-size: Trim image to given size 7976 7977 Syntax: `-trim-to-size <size_vector>` 7978 7979 Like **-trim**, this command trims the background in an image. However, 7980 instead of **-trim**, you specify the target size of the output region. The 7981 actual region may be smaller if the specified region falls outside the 7982 boundaries of the input image. For example, if you want a 64x64x128 image 7983 containing all the foreground pixels in your image, call 7984 7985 c3d in.img -trim-to-size 64x64x128vox -o out.img""" 7986 7987 def run( 7988 self, 7989 execution: Execution, 7990 ) -> list[str]: 7991 """ 7992 Build command line arguments. This method is called by the main command. 7993 7994 Args: 7995 execution: The execution object. 7996 Returns: 7997 Command line arguments 7998 """ 7999 cargs = [] 8000 cargs.extend([ 8001 "-trim-to-size", 8002 self.trim_to_size 8003 ]) 8004 return cargs 8005 8006 8007@dataclasses.dataclass 8008class C3dType: 8009 """ 8010 -type: Specify pixel type for image output 8011 8012 Syntax: `-type < char | uchar | short | ushort | int | uint | float | double 8013 > ` 8014 8015 Specifies the pixel type for the output image. By default, images are 8016 written in floating point (**float**) format. The type does not affect how 8017 images are processed, only how they are saved. 8018 8019 c3d image1.img -type short image2.img 8020 8021 Some images require data in certain types. For example, to save PNG images, 8022 uchar or ushort type must be specified. 8023 """ 8024 type_: str 8025 """-type: Specify pixel type for image output 8026 8027 Syntax: `-type < char | uchar | short | ushort | int | uint | float | double 8028 > ` 8029 8030 Specifies the pixel type for the output image. By default, images are 8031 written in floating point (**float**) format. The type does not affect how 8032 images are processed, only how they are saved. 8033 8034 c3d image1.img -type short image2.img 8035 8036 Some images require data in certain types. For example, to save PNG images, 8037 uchar or ushort type must be specified.""" 8038 8039 def run( 8040 self, 8041 execution: Execution, 8042 ) -> list[str]: 8043 """ 8044 Build command line arguments. This method is called by the main command. 8045 8046 Args: 8047 execution: The execution object. 8048 Returns: 8049 Command line arguments 8050 """ 8051 cargs = [] 8052 cargs.extend([ 8053 "-type", 8054 self.type_ 8055 ]) 8056 return cargs 8057 8058 8059@dataclasses.dataclass 8060class C3dVerbose: 8061 """ 8062 -verbose: Enable verbose output of commands 8063 8064 Syntax: `-verbose` 8065 8066 Commands entered after the **-verbose** command will print debugging 8067 information. This can be turned off with **-noverbose**. 8068 8069 ### Parameter Specifications. 8070 """ 8071 verbose: str 8072 """-verbose: Enable verbose output of commands 8073 8074 Syntax: `-verbose` 8075 8076 Commands entered after the **-verbose** command will print debugging 8077 information. This can be turned off with **-noverbose**. 8078 8079 ### Parameter Specifications""" 8080 8081 def run( 8082 self, 8083 execution: Execution, 8084 ) -> list[str]: 8085 """ 8086 Build command line arguments. This method is called by the main command. 8087 8088 Args: 8089 execution: The execution object. 8090 Returns: 8091 Command line arguments 8092 """ 8093 cargs = [] 8094 cargs.extend([ 8095 "-verbose", 8096 self.verbose 8097 ]) 8098 return cargs 8099 8100 8101@dataclasses.dataclass 8102class C3dNoverbose: 8103 """ 8104 No description found. 8105 """ 8106 noverbose: str 8107 """No description found.""" 8108 8109 def run( 8110 self, 8111 execution: Execution, 8112 ) -> list[str]: 8113 """ 8114 Build command line arguments. This method is called by the main command. 8115 8116 Args: 8117 execution: The execution object. 8118 Returns: 8119 Command line arguments 8120 """ 8121 cargs = [] 8122 cargs.extend([ 8123 "-noverbose", 8124 self.noverbose 8125 ]) 8126 return cargs 8127 8128 8129@dataclasses.dataclass 8130class C3dVersion: 8131 """ 8132 No description found. 8133 """ 8134 version: str 8135 """No description found.""" 8136 8137 def run( 8138 self, 8139 execution: Execution, 8140 ) -> list[str]: 8141 """ 8142 Build command line arguments. This method is called by the main command. 8143 8144 Args: 8145 execution: The execution object. 8146 Returns: 8147 Command line arguments 8148 """ 8149 cargs = [] 8150 cargs.extend([ 8151 "-version", 8152 self.version 8153 ]) 8154 return cargs 8155 8156 8157@dataclasses.dataclass 8158class C3dVote: 8159 """ 8160 -vote: Vote among images on the stack 8161 8162 Syntax: `-vote ` 8163 8164 This command takes all images on the stack as arguments and at each voxel 8165 *(i,j,k)* returns the index of the image for which the image value at 8166 *(i,j,k)* is the greatest. This is most useful when combining probability 8167 maps into a single label image. If images prob1.img, prob2.img, etc. give 8168 the probability of label 1, 2, etc. over the image domain, the **-vote** 8169 command will return the most probable label at each voxel. 8170 8171 c3d prob1.img prob2.img prob3.img -vote -type uchar -o label.img 8172 8173 The value assigned to each image is based on its position from the bottom of 8174 the stack, with zero indicating bottom-most image. In the example above, the 8175 output image has values 0 for voxels where prob1.img is highest, 1 for 8176 prob2.img and 2 for prob3.img. Also see the related commands **-split** and 8177 **-merge**. 8178 """ 8179 vote: str 8180 """-vote: Vote among images on the stack 8181 8182 Syntax: `-vote ` 8183 8184 This command takes all images on the stack as arguments and at each voxel 8185 *(i,j,k)* returns the index of the image for which the image value at 8186 *(i,j,k)* is the greatest. This is most useful when combining probability 8187 maps into a single label image. If images prob1.img, prob2.img, etc. give 8188 the probability of label 1, 2, etc. over the image domain, the **-vote** 8189 command will return the most probable label at each voxel. 8190 8191 c3d prob1.img prob2.img prob3.img -vote -type uchar -o label.img 8192 8193 The value assigned to each image is based on its position from the bottom of 8194 the stack, with zero indicating bottom-most image. In the example above, the 8195 output image has values 0 for voxels where prob1.img is highest, 1 for 8196 prob2.img and 2 for prob3.img. Also see the related commands **-split** and 8197 **-merge**.""" 8198 8199 def run( 8200 self, 8201 execution: Execution, 8202 ) -> list[str]: 8203 """ 8204 Build command line arguments. This method is called by the main command. 8205 8206 Args: 8207 execution: The execution object. 8208 Returns: 8209 Command line arguments 8210 """ 8211 cargs = [] 8212 cargs.extend([ 8213 "-vote", 8214 self.vote 8215 ]) 8216 return cargs 8217 8218 8219@dataclasses.dataclass 8220class C3dVoteMrf: 8221 """ 8222 -vote-mrf: Vote with Markov Random Field regularlization 8223 8224 Syntax: `-vote-mrf <mode> <lambda>` 8225 8226 This command is similar to **-vote** but it performs regularlization using 8227 the Markov Random Field (MRF). This form of regularization penalizes the 8228 total surface area of the segments in the output. It results in more 8229 contiguous segments. 8230 8231 The command takes all the images on the stack and assumes that they are 8232 likelihood images corresponding to labels 1, 2, ... N. This means that voxel 8233 **x** in image **k** holds the probability that voxel **x** has label **k**. 8234 Likelihood images must be between 0 and 1. Any values outside of the range 8235 are interpreted as the voxel being excluded from the voting. These voxels 8236 will be assigned label 0 in the output. 8237 8238 The problem is encoded in the form of energy minimization, consisting of a 8239 data term and a regularization term. The data term encodes the cost 8240 (penalty) associated with assigning the voxel **x** the label **k**. The 8241 parameter **mode** describes how likelihood images are mapped to the cost. 8242 8243 * `VOTES_AGAINST` or `VA`. This mode is useful when the command is being 8244 used to combine several multi-label segmentations into a single one. Each 8245 likelihood image is assumed to be the proportion of segmentations that 8246 assign label *k* to voxel *x*. The data term equals to the error associated 8247 to assining the voxel *k* label *x*. This error is calculated as the sum of 8248 the likelihoods for all labels at *x* minus the likelihood for *k* at *x*. 8249 Note that the likelihoods do not have to add up to one, which may be 8250 interpreted as missing data for some voxels. 8251 8252 * `LOG_LIKELIHOOD` or `LL`. The cost for label *k* at voxel *x* is the 8253 logarithm of the k-th likelihood image at *x*. This will assign infinite 8254 cost when the likelihood is zero. 8255 8256 The regularlization term is encoded as **lambda** times the total number of 8257 neighboring voxels inside the mask (non-excluded region of the image) that 8258 have different labels. 8259 8260 The optmization problem is solved using the Alpha-Expansion graph cut 8261 algorithm. Users of this functionality should cite the following papers. 8262 8263 1. Yuri Boykov, Olga Veksler, Ramin Zabih, *Efficient Approximate Energy 8264 Minimization via Graph Cuts*, IEEE transactions on PAMI, vol. 20, no. 12, p. 8265 1222-1239, 2001. 8266 8267 2. Vladimir Kolmogorov and Ramin Zabih, *What Energy Functions can be 8268 Minimized via Graph Cuts?*, IEEE transactions on PAMI, vol. 26, no. 2, p. 8269 147-159, 2004. 8270 8271 3. Yuri Boykov and Vladimir Kolmogorov, *An Experimental Comparison of 8272 Min-Cut/Max-Flow Algorithms for Energy Minimization in Vision*, IEEE 8273 transactions on PAMI, vol. 26, no. 9, p. 1124-1137, 2004. 8274 8275 As noted in the open source implementation of the graph cuts algorithms 8276 distributed under the General Public License, "This software can be used 8277 only for research purposes, you should cite the aforementioned paper in any 8278 resulting publication. If you wish to use this software (or the algorithms 8279 described in the aforementioned paper) for commercial purposes, you should 8280 be aware that there is a US patent: R. Zabih, Y. Boykov, O. Veksler, *System 8281 and method for fast approximate energy minimization via graph cuts*, United 8282 Stated Patent 6,744,923, June 1, 2004. 8283 8284 The example below illustrates applying **-vote-mrf** with a user-specified 8285 mask. Voxels outside of the mask are first remapped to NaN (not a number) 8286 and thus excluded from the MRF optimization and given 0 label. 8287 8288 c3d lhood01.nii lhood02.nii lhood03.nii mask.nii -popas M \ 8289 -foreach -push M -replace 0 NaN -times -endfor \ 8290 -vote-mrf VA 0.2 -o result.nii. 8291 """ 8292 vote_mrf: str 8293 """-vote-mrf: Vote with Markov Random Field regularlization 8294 8295 Syntax: `-vote-mrf <mode> <lambda>` 8296 8297 This command is similar to **-vote** but it performs regularlization using 8298 the Markov Random Field (MRF). This form of regularization penalizes the 8299 total surface area of the segments in the output. It results in more 8300 contiguous segments. 8301 8302 The command takes all the images on the stack and assumes that they are 8303 likelihood images corresponding to labels 1, 2, ... N. This means that voxel 8304 **x** in image **k** holds the probability that voxel **x** has label **k**. 8305 Likelihood images must be between 0 and 1. Any values outside of the range 8306 are interpreted as the voxel being excluded from the voting. These voxels 8307 will be assigned label 0 in the output. 8308 8309 The problem is encoded in the form of energy minimization, consisting of a 8310 data term and a regularization term. The data term encodes the cost 8311 (penalty) associated with assigning the voxel **x** the label **k**. The 8312 parameter **mode** describes how likelihood images are mapped to the cost. 8313 8314 * `VOTES_AGAINST` or `VA`. This mode is useful when the command is being 8315 used to combine several multi-label segmentations into a single one. Each 8316 likelihood image is assumed to be the proportion of segmentations that 8317 assign label *k* to voxel *x*. The data term equals to the error associated 8318 to assining the voxel *k* label *x*. This error is calculated as the sum of 8319 the likelihoods for all labels at *x* minus the likelihood for *k* at *x*. 8320 Note that the likelihoods do not have to add up to one, which may be 8321 interpreted as missing data for some voxels. 8322 8323 * `LOG_LIKELIHOOD` or `LL`. The cost for label *k* at voxel *x* is the 8324 logarithm of the k-th likelihood image at *x*. This will assign infinite 8325 cost when the likelihood is zero. 8326 8327 The regularlization term is encoded as **lambda** times the total number of 8328 neighboring voxels inside the mask (non-excluded region of the image) that 8329 have different labels. 8330 8331 The optmization problem is solved using the Alpha-Expansion graph cut 8332 algorithm. Users of this functionality should cite the following papers. 8333 8334 1. Yuri Boykov, Olga Veksler, Ramin Zabih, *Efficient Approximate Energy 8335 Minimization via Graph Cuts*, IEEE transactions on PAMI, vol. 20, no. 12, p. 8336 1222-1239, 2001. 8337 8338 2. Vladimir Kolmogorov and Ramin Zabih, *What Energy Functions can be 8339 Minimized via Graph Cuts?*, IEEE transactions on PAMI, vol. 26, no. 2, p. 8340 147-159, 2004. 8341 8342 3. Yuri Boykov and Vladimir Kolmogorov, *An Experimental Comparison of 8343 Min-Cut/Max-Flow Algorithms for Energy Minimization in Vision*, IEEE 8344 transactions on PAMI, vol. 26, no. 9, p. 1124-1137, 2004. 8345 8346 As noted in the open source implementation of the graph cuts algorithms 8347 distributed under the General Public License, "This software can be used 8348 only for research purposes, you should cite the aforementioned paper in any 8349 resulting publication. If you wish to use this software (or the algorithms 8350 described in the aforementioned paper) for commercial purposes, you should 8351 be aware that there is a US patent: R. Zabih, Y. Boykov, O. Veksler, *System 8352 and method for fast approximate energy minimization via graph cuts*, United 8353 Stated Patent 6,744,923, June 1, 2004. 8354 8355 The example below illustrates applying **-vote-mrf** with a user-specified 8356 mask. Voxels outside of the mask are first remapped to NaN (not a number) 8357 and thus excluded from the MRF optimization and given 0 label. 8358 8359 c3d lhood01.nii lhood02.nii lhood03.nii mask.nii -popas M \ 8360 -foreach -push M -replace 0 NaN -times -endfor \ 8361 -vote-mrf VA 0.2 -o result.nii""" 8362 8363 def run( 8364 self, 8365 execution: Execution, 8366 ) -> list[str]: 8367 """ 8368 Build command line arguments. This method is called by the main command. 8369 8370 Args: 8371 execution: The execution object. 8372 Returns: 8373 Command line arguments 8374 """ 8375 cargs = [] 8376 cargs.extend([ 8377 "-vote-mrf", 8378 self.vote_mrf 8379 ]) 8380 return cargs 8381 8382 8383@dataclasses.dataclass 8384class C3dVoteLabel: 8385 """ 8386 No description found. 8387 """ 8388 vote_label: str 8389 """No description found.""" 8390 8391 def run( 8392 self, 8393 execution: Execution, 8394 ) -> list[str]: 8395 """ 8396 Build command line arguments. This method is called by the main command. 8397 8398 Args: 8399 execution: The execution object. 8400 Returns: 8401 Command line arguments 8402 """ 8403 cargs = [] 8404 cargs.extend([ 8405 "-vote-label", 8406 self.vote_label 8407 ]) 8408 return cargs 8409 8410 8411@dataclasses.dataclass 8412class C3dVoxelSum: 8413 """ 8414 -voxel-sum: Print sum of all voxel intensities 8415 8416 Syntax: `-voxel-sum ` 8417 8418 Print the sum of all voxels in the image. 8419 8420 $ c3d image.img -voxel-sum 8421 Voxel Sum: 200923123. 8422 """ 8423 voxel_sum: str 8424 """-voxel-sum: Print sum of all voxel intensities 8425 8426 Syntax: `-voxel-sum ` 8427 8428 Print the sum of all voxels in the image. 8429 8430 $ c3d image.img -voxel-sum 8431 Voxel Sum: 200923123""" 8432 8433 def run( 8434 self, 8435 execution: Execution, 8436 ) -> list[str]: 8437 """ 8438 Build command line arguments. This method is called by the main command. 8439 8440 Args: 8441 execution: The execution object. 8442 Returns: 8443 Command line arguments 8444 """ 8445 cargs = [] 8446 cargs.extend([ 8447 "-voxel-sum", 8448 self.voxel_sum 8449 ]) 8450 return cargs 8451 8452 8453@dataclasses.dataclass 8454class C3dVoxelIntegral: 8455 """ 8456 -voxel-integral: Print volume integral of all voxel intensities 8457 8458 Syntax: `-voxel-integral` 8459 8460 Like **-voxel-sum**, but multiplies the sum of voxel intensities by voxel 8461 volume. This is useful for computing volumes of objects represented by 8462 binary images. The result is in 'ml'. 8463 8464 $ c3d image.img -voxel-integral 8465 Voxel Integral: 2341. 8466 """ 8467 voxel_integral: str 8468 """-voxel-integral: Print volume integral of all voxel intensities 8469 8470 Syntax: `-voxel-integral` 8471 8472 Like **-voxel-sum**, but multiplies the sum of voxel intensities by voxel 8473 volume. This is useful for computing volumes of objects represented by 8474 binary images. The result is in 'ml'. 8475 8476 $ c3d image.img -voxel-integral 8477 Voxel Integral: 2341""" 8478 8479 def run( 8480 self, 8481 execution: Execution, 8482 ) -> list[str]: 8483 """ 8484 Build command line arguments. This method is called by the main command. 8485 8486 Args: 8487 execution: The execution object. 8488 Returns: 8489 Command line arguments 8490 """ 8491 cargs = [] 8492 cargs.extend([ 8493 "-voxel-integral", 8494 self.voxel_integral 8495 ]) 8496 return cargs 8497 8498 8499@dataclasses.dataclass 8500class C3dVoxelwiseRegression: 8501 """ 8502 -voxreg, -voxelwise-regression: Regression between two images 8503 8504 Syntax: `-voxreg regression_order ` 8505 8506 Perform regression between corresponding voxels in two images. This command 8507 takes two images as input, X and Y. This command finds parameters b\_0, 8508 b\_1, ..., b\_k, such that Y is best approximated by b\_0 + b\_1 * X + b\_2 8509 * X^2 + ... + b_k * X^k. Here is an example of linear regression. 8510 8511 $ c3d Y.nii X.nii -voxreg 2 8512 REGCOEFF[0] = 5.56935 8513 REGCOEFF[1] = 0.844024 8514 8515 $ c3d Y.nii X.nii -scale 0.844024 -shift 5.56935 -voxreg 2 8516 REGCOEFF[0] = 0 8517 REGCOEFF[1] = 1. 8518 """ 8519 voxelwise_regression: str 8520 """-voxreg, -voxelwise-regression: Regression between two images 8521 8522 Syntax: `-voxreg regression_order ` 8523 8524 Perform regression between corresponding voxels in two images. This command 8525 takes two images as input, X and Y. This command finds parameters b\_0, 8526 b\_1, ..., b\_k, such that Y is best approximated by b\_0 + b\_1 * X + b\_2 8527 * X^2 + ... + b_k * X^k. Here is an example of linear regression. 8528 8529 $ c3d Y.nii X.nii -voxreg 2 8530 REGCOEFF[0] = 5.56935 8531 REGCOEFF[1] = 0.844024 8532 8533 $ c3d Y.nii X.nii -scale 0.844024 -shift 5.56935 -voxreg 2 8534 REGCOEFF[0] = 0 8535 REGCOEFF[1] = 1""" 8536 8537 def run( 8538 self, 8539 execution: Execution, 8540 ) -> list[str]: 8541 """ 8542 Build command line arguments. This method is called by the main command. 8543 8544 Args: 8545 execution: The execution object. 8546 Returns: 8547 Command line arguments 8548 """ 8549 cargs = [] 8550 cargs.extend([ 8551 "-voxelwise-regression", 8552 self.voxelwise_regression 8553 ]) 8554 return cargs 8555 8556 8557@dataclasses.dataclass 8558class C3dWarp: 8559 """ 8560 No description found. 8561 """ 8562 warp: str 8563 """No description found.""" 8564 8565 def run( 8566 self, 8567 execution: Execution, 8568 ) -> list[str]: 8569 """ 8570 Build command line arguments. This method is called by the main command. 8571 8572 Args: 8573 execution: The execution object. 8574 Returns: 8575 Command line arguments 8576 """ 8577 cargs = [] 8578 cargs.extend([ 8579 "-warp", 8580 self.warp 8581 ]) 8582 return cargs 8583 8584 8585@dataclasses.dataclass 8586class C3dWarpLabel: 8587 """ 8588 No description found. 8589 """ 8590 warp_label: str 8591 """No description found.""" 8592 8593 def run( 8594 self, 8595 execution: Execution, 8596 ) -> list[str]: 8597 """ 8598 Build command line arguments. This method is called by the main command. 8599 8600 Args: 8601 execution: The execution object. 8602 Returns: 8603 Command line arguments 8604 """ 8605 cargs = [] 8606 cargs.extend([ 8607 "-warp-label", 8608 self.warp_label 8609 ]) 8610 return cargs 8611 8612 8613@dataclasses.dataclass 8614class C3dWrap: 8615 """ 8616 -wrap: Wrap (rotate) image 8617 8618 Syntax: `-wrap <vector> ` 8619 8620 Wrap image around one or more voxel dimensions. Wrapping is typically used 8621 to correct for MRI wrap-around artifacts. The vector must have integer 8622 components, possibly negative. For example, 8623 8624 c3d badmri.nii.gz -wrap 0x20x0 -o fixedmri.nii.gz 8625 8626 will wrap the image in the second voxel dimension by 20 voxels (i.e., voxel 8627 at 10x40x20 will me moved to the position 10x20x20). 8628 8629 8630 ### Commands: Options and Parameters 8631 8632 Options change the behavior of commands that *appear later on the command 8633 line*. This is very important. Specifying options after the command will 8634 have no effect. 8635 """ 8636 wrap: str 8637 """-wrap: Wrap (rotate) image 8638 8639 Syntax: `-wrap <vector> ` 8640 8641 Wrap image around one or more voxel dimensions. Wrapping is typically used 8642 to correct for MRI wrap-around artifacts. The vector must have integer 8643 components, possibly negative. For example, 8644 8645 c3d badmri.nii.gz -wrap 0x20x0 -o fixedmri.nii.gz 8646 8647 will wrap the image in the second voxel dimension by 20 voxels (i.e., voxel 8648 at 10x40x20 will me moved to the position 10x20x20). 8649 8650 8651 ### Commands: Options and Parameters 8652 8653 Options change the behavior of commands that *appear later on the command 8654 line*. This is very important. Specifying options after the command will 8655 have no effect.""" 8656 8657 def run( 8658 self, 8659 execution: Execution, 8660 ) -> list[str]: 8661 """ 8662 Build command line arguments. This method is called by the main command. 8663 8664 Args: 8665 execution: The execution object. 8666 Returns: 8667 Command line arguments 8668 """ 8669 cargs = [] 8670 cargs.extend([ 8671 "-wrap", 8672 self.wrap 8673 ]) 8674 return cargs 8675 8676 8677@dataclasses.dataclass 8678class C3dWeightedSum: 8679 """ 8680 -wsum, -weighted-sum: Weighed sum of images with constant weights 8681 8682 Syntax: `-wsum weight1 weight2 ... weightN ` 8683 8684 Computes weighted sum of the last N images on the stack. 8685 8686 c3d image1.nii image2.nii image3.nii -wsum 0.2 0.7 0.1 -o wsum.nii 8687 8688 This command is particularly useful for combining components in a 8689 multicomponent image. For example, for an RGB image, we can convert it to 8690 grayscale (using [ImageMagick][13] formula) as follows: 8691 8692 c3d -mcs rgb.nii -wsum 0.29900 0.58700 0.11400 -o gray.nii. 8693 """ 8694 weighted_sum: str 8695 """-wsum, -weighted-sum: Weighed sum of images with constant weights 8696 8697 Syntax: `-wsum weight1 weight2 ... weightN ` 8698 8699 Computes weighted sum of the last N images on the stack. 8700 8701 c3d image1.nii image2.nii image3.nii -wsum 0.2 0.7 0.1 -o wsum.nii 8702 8703 This command is particularly useful for combining components in a 8704 multicomponent image. For example, for an RGB image, we can convert it to 8705 grayscale (using [ImageMagick][13] formula) as follows: 8706 8707 c3d -mcs rgb.nii -wsum 0.29900 0.58700 0.11400 -o gray.nii""" 8708 8709 def run( 8710 self, 8711 execution: Execution, 8712 ) -> list[str]: 8713 """ 8714 Build command line arguments. This method is called by the main command. 8715 8716 Args: 8717 execution: The execution object. 8718 Returns: 8719 Command line arguments 8720 """ 8721 cargs = [] 8722 cargs.extend([ 8723 "-weighted-sum", 8724 self.weighted_sum 8725 ]) 8726 return cargs 8727 8728 8729@dataclasses.dataclass 8730class C3dWeightedSumVoxelwise: 8731 """ 8732 -wsv, -weighed-sum-voxelwise: Weighed sum of images with spatially varying 8733 weights 8734 8735 Syntax: `-wsv ` 8736 8737 Computes weighted sum of N weight images and N scalar images. The images 8738 must be interleaved on the stack. All images on the stack are used. 8739 8740 c3d weight1.nii image1.nii weight2.nii image2.nii weight3.nii image3.nii 8741 -wsv -o mysum.nii.gz 8742 8743 The **-reorder** command can simplify loading the images: 8744 8745 c3d weight*.nii image*.nii -reorder 0.5 -wsv -o mysum.nii.gz 8746 8747 ### Commands: Image Header Manipulation. 8748 """ 8749 weighted_sum_voxelwise: str 8750 """-wsv, -weighed-sum-voxelwise: Weighed sum of images with spatially 8751 varying weights 8752 8753 Syntax: `-wsv ` 8754 8755 Computes weighted sum of N weight images and N scalar images. The images 8756 must be interleaved on the stack. All images on the stack are used. 8757 8758 c3d weight1.nii image1.nii weight2.nii image2.nii weight3.nii image3.nii 8759 -wsv -o mysum.nii.gz 8760 8761 The **-reorder** command can simplify loading the images: 8762 8763 c3d weight*.nii image*.nii -reorder 0.5 -wsv -o mysum.nii.gz 8764 8765 ### Commands: Image Header Manipulation""" 8766 8767 def run( 8768 self, 8769 execution: Execution, 8770 ) -> list[str]: 8771 """ 8772 Build command line arguments. This method is called by the main command. 8773 8774 Args: 8775 execution: The execution object. 8776 Returns: 8777 Command line arguments 8778 """ 8779 cargs = [] 8780 cargs.extend([ 8781 "-weighted-sum-voxelwise", 8782 self.weighted_sum_voxelwise 8783 ]) 8784 return cargs 8785 8786 8787class C3dOutputs(typing.NamedTuple): 8788 """ 8789 Output object returned when calling `c3d_(...)`. 8790 """ 8791 root: OutputPathType 8792 """Output root folder. This is the root folder for all outputs.""" 8793 operations: typing.List[typing.Union[C3dOutputOutputs]] 8794 """Outputs from `C3dOutput`.This is a list of outputs with the same length 8795 and order as the inputs.""" 8796 8797 8798def c3d_( 8799 input_: list[InputPathType], 8800 operations: list[typing.Union[C3dAccum, C3dAcos, C3dAdd, C3dAlignLandmarks, C3dAnisotropicDiffusion, C3dAntialias, C3dSet, C3dAsin, C3dAtan2, C3dBackground, C3dN4BiasCorrection, C3dBinarize, C3dCanny, C3dCeil, C3dCentroid, C3dCentroidMark, C3dConnectedComponents, C3dClear, C3dClip, C3dColorMap, C3dCompress, C3dNoCompress, C3dConv, C3dCoordinateMapVoxel, C3dCoordinateMapPhysical, C3dCopyTransform, C3dCos, C3dCreate, C3dDicomSeriesList, C3dDicomSeriesRead, C3dDilate, C3dDivide, C3dDuplicate, C3dEndaccum, C3dEndfor, C3dErode, C3dErf, C3dExp, C3dExportPatches, C3dExportPatchesAug, C3dExtrudeSeg, C3dFillBackgroundWithNoise, C3dFft, C3dFlip, C3dFloor, C3dForeach, C3dForeachComp, C3dGlm, C3dGradient, C3dHelp, C3dHolefill, C3dHessianEigenvalues, C3dHessianObjectness, C3dHistogramMatch, C3dInfo, C3dInfoFull, C3dInsert, C3dInterpolation, C3dIterations, C3dLabelOverlap, C3dLabelStatistics, C3dLandmarksToSpheres, C3dLaplacian, C3dLevelset, C3dLevelsetCurvature, C3dLevelsetAdvection, C3dLog, C3dLog10, C3dManual, C3dMatchBoundingBox, C3dMaximum, C3dMulticomponentSplit, C3dMean, C3dMedianFilter, C3dMerge, C3dMeanFilter, C3dMutualInfo, C3dMinimum, C3dMixtureModel, C3dMoments, C3dMattesMutualInfo, C3dMeanSquare, C3dMultiply, C3dNormalizedCrossCorrelation, C3dNormalizedCorrelation, C3dNormalizedMutualInfo, C3dNoiseGaussian, C3dNoisePoisson, C3dNoiseSpeckle, C3dNoiseSaltPepper, C3dNoMulticomponentSplit, C3dNormalizeLocalWindow, C3dNormpdf, C3dNoround, C3dNospm, C3dOutput, C3dOutputMulticomponent, C3dOutputMultipleMulticomponent, C3dOrient, C3dOutputMultiple, C3dOrient_, C3dOrigin, C3dOriginVoxel, C3dOriginVoxelCoord, C3dOverlap, C3dOverlayLabelImage, C3dPad, C3dPadTo, C3dPca, C3dPercentIntensityMode, C3dPixel, C3dPop, C3dPopas, C3dProbe, C3dPush, C3dRank, C3dReciprocal, C3dRegion, C3dReorder, C3dRetainLabels, C3dRfApply, C3dRfTrain, C3dRfParamPatch, C3dRfParamUsexyz, C3dRfParamNousexyz, C3dRfParamNtrees, C3dRfParamTreedepth, C3dSetSform, C3dReplace, C3dResample, C3dResampleIso, C3dResampleMm, C3dResliceItk, C3dResliceMatrix, C3dResliceIdentity, C3dRgb2hsv, C3dRms, C3dRound, C3dScale, C3dSetSform_, C3dSin, C3dSlice, C3dSliceAll, C3dSharpen, C3dShift, C3dSignedDistanceTransform, C3dSmooth, C3dSmoothFast, C3dSpacing, C3dSplit, C3dSqrt, C3dStaple, C3dStructureTensorEigenvalues, C3dSpm, C3dSubtract, C3dSupervoxel, C3dStretch, C3dSwapdim, C3dTestImage, C3dTestProbe, C3dThreshold, C3dTile, C3dTrim, C3dTrimToSize, C3dType, C3dVerbose, C3dNoverbose, C3dVersion, C3dVote, C3dVoteMrf, C3dVoteLabel, C3dVoxelSum, C3dVoxelIntegral, C3dVoxelwiseRegression, C3dWarp, C3dWarpLabel, C3dWrap, C3dWeightedSum, C3dWeightedSumVoxelwise]], 8801 output: str, 8802 runner: Runner | None = None, 8803) -> C3dOutputs: 8804 """ 8805 C3D is a command-line tool for medical image processing. 8806 8807 Author: ITK-Snap Team 8808 8809 Args: 8810 input_: The input image to process. 8811 operations: The operations to perform. 8812 output: The output image. 8813 runner: Command runner. 8814 Returns: 8815 NamedTuple of outputs (described in `C3dOutputs`). 8816 """ 8817 runner = runner or get_global_runner() 8818 execution = runner.start_execution(C3D_METADATA) 8819 cargs = [] 8820 cargs.append("c3d") 8821 cargs.append(" ".join([execution.input_file(f) for f in input_])) 8822 cargs.extend([a for c in [s.run(execution) for s in operations] for a in c]) 8823 cargs.extend([ 8824 "-o", 8825 output 8826 ]) 8827 ret = C3dOutputs( 8828 root=execution.output_file("."), 8829 operations=[i.outputs(execution) if hasattr(i, "outputs") else None for i in operations], 8830 ) 8831 execution.run(cargs) 8832 return ret 8833 8834 8835__all__ = [ 8836 "C3D_METADATA", 8837 "C3dAccum", 8838 "C3dAcos", 8839 "C3dAdd", 8840 "C3dAlignLandmarks", 8841 "C3dAnisotropicDiffusion", 8842 "C3dAntialias", 8843 "C3dAsin", 8844 "C3dAtan2", 8845 "C3dBackground", 8846 "C3dBinarize", 8847 "C3dCanny", 8848 "C3dCeil", 8849 "C3dCentroid", 8850 "C3dCentroidMark", 8851 "C3dClear", 8852 "C3dClip", 8853 "C3dColorMap", 8854 "C3dCompress", 8855 "C3dConnectedComponents", 8856 "C3dConv", 8857 "C3dCoordinateMapPhysical", 8858 "C3dCoordinateMapVoxel", 8859 "C3dCopyTransform", 8860 "C3dCos", 8861 "C3dCreate", 8862 "C3dDicomSeriesList", 8863 "C3dDicomSeriesRead", 8864 "C3dDilate", 8865 "C3dDivide", 8866 "C3dDuplicate", 8867 "C3dEndaccum", 8868 "C3dEndfor", 8869 "C3dErf", 8870 "C3dErode", 8871 "C3dExp", 8872 "C3dExportPatches", 8873 "C3dExportPatchesAug", 8874 "C3dExtrudeSeg", 8875 "C3dFft", 8876 "C3dFillBackgroundWithNoise", 8877 "C3dFlip", 8878 "C3dFloor", 8879 "C3dForeach", 8880 "C3dForeachComp", 8881 "C3dGlm", 8882 "C3dGradient", 8883 "C3dHelp", 8884 "C3dHessianEigenvalues", 8885 "C3dHessianObjectness", 8886 "C3dHistogramMatch", 8887 "C3dHolefill", 8888 "C3dInfo", 8889 "C3dInfoFull", 8890 "C3dInsert", 8891 "C3dInterpolation", 8892 "C3dIterations", 8893 "C3dLabelOverlap", 8894 "C3dLabelStatistics", 8895 "C3dLandmarksToSpheres", 8896 "C3dLaplacian", 8897 "C3dLevelset", 8898 "C3dLevelsetAdvection", 8899 "C3dLevelsetCurvature", 8900 "C3dLog", 8901 "C3dLog10", 8902 "C3dManual", 8903 "C3dMatchBoundingBox", 8904 "C3dMattesMutualInfo", 8905 "C3dMaximum", 8906 "C3dMean", 8907 "C3dMeanFilter", 8908 "C3dMeanSquare", 8909 "C3dMedianFilter", 8910 "C3dMerge", 8911 "C3dMinimum", 8912 "C3dMixtureModel", 8913 "C3dMoments", 8914 "C3dMulticomponentSplit", 8915 "C3dMultiply", 8916 "C3dMutualInfo", 8917 "C3dN4BiasCorrection", 8918 "C3dNoCompress", 8919 "C3dNoMulticomponentSplit", 8920 "C3dNoiseGaussian", 8921 "C3dNoisePoisson", 8922 "C3dNoiseSaltPepper", 8923 "C3dNoiseSpeckle", 8924 "C3dNormalizeLocalWindow", 8925 "C3dNormalizedCorrelation", 8926 "C3dNormalizedCrossCorrelation", 8927 "C3dNormalizedMutualInfo", 8928 "C3dNormpdf", 8929 "C3dNoround", 8930 "C3dNospm", 8931 "C3dNoverbose", 8932 "C3dOrient", 8933 "C3dOrient_", 8934 "C3dOrigin", 8935 "C3dOriginVoxel", 8936 "C3dOriginVoxelCoord", 8937 "C3dOutput", 8938 "C3dOutputMulticomponent", 8939 "C3dOutputMultiple", 8940 "C3dOutputMultipleMulticomponent", 8941 "C3dOutputOutputs", 8942 "C3dOutputs", 8943 "C3dOverlap", 8944 "C3dOverlayLabelImage", 8945 "C3dPad", 8946 "C3dPadTo", 8947 "C3dPca", 8948 "C3dPercentIntensityMode", 8949 "C3dPixel", 8950 "C3dPop", 8951 "C3dPopas", 8952 "C3dProbe", 8953 "C3dPush", 8954 "C3dRank", 8955 "C3dReciprocal", 8956 "C3dRegion", 8957 "C3dReorder", 8958 "C3dReplace", 8959 "C3dResample", 8960 "C3dResampleIso", 8961 "C3dResampleMm", 8962 "C3dResliceIdentity", 8963 "C3dResliceItk", 8964 "C3dResliceMatrix", 8965 "C3dRetainLabels", 8966 "C3dRfApply", 8967 "C3dRfParamNousexyz", 8968 "C3dRfParamNtrees", 8969 "C3dRfParamPatch", 8970 "C3dRfParamTreedepth", 8971 "C3dRfParamUsexyz", 8972 "C3dRfTrain", 8973 "C3dRgb2hsv", 8974 "C3dRms", 8975 "C3dRound", 8976 "C3dScale", 8977 "C3dSet", 8978 "C3dSetSform", 8979 "C3dSetSform_", 8980 "C3dSharpen", 8981 "C3dShift", 8982 "C3dSignedDistanceTransform", 8983 "C3dSin", 8984 "C3dSlice", 8985 "C3dSliceAll", 8986 "C3dSmooth", 8987 "C3dSmoothFast", 8988 "C3dSpacing", 8989 "C3dSplit", 8990 "C3dSpm", 8991 "C3dSqrt", 8992 "C3dStaple", 8993 "C3dStretch", 8994 "C3dStructureTensorEigenvalues", 8995 "C3dSubtract", 8996 "C3dSupervoxel", 8997 "C3dSwapdim", 8998 "C3dTestImage", 8999 "C3dTestProbe", 9000 "C3dThreshold", 9001 "C3dTile", 9002 "C3dTrim", 9003 "C3dTrimToSize", 9004 "C3dType", 9005 "C3dVerbose", 9006 "C3dVersion", 9007 "C3dVote", 9008 "C3dVoteLabel", 9009 "C3dVoteMrf", 9010 "C3dVoxelIntegral", 9011 "C3dVoxelSum", 9012 "C3dVoxelwiseRegression", 9013 "C3dWarp", 9014 "C3dWarpLabel", 9015 "C3dWeightedSum", 9016 "C3dWeightedSumVoxelwise", 9017 "C3dWrap", 9018 "c3d_", 9019]
18@dataclasses.dataclass 19class C3dAccum: 20 """ 21 -accum, -endaccum: Accumulate operations over all images 22 23 Syntax: `-accum command-list -endaccum` 24 25 Apply a binary operation (such as addition or multiplication) to all the 26 images on the stack in a cumulative fashion. The command(s) will be applied 27 to the last and second-to-last images on the stack, then to the result of 28 this operation and the third-to-last image on the stack and so on. Below is 29 the example of using the command to add multiple images. 30 31 c3d image*.nii -accum -add -endaccum -o sum.nii. 32 """ 33 accum: str 34 """-accum, -endaccum: Accumulate operations over all images 35 36 Syntax: `-accum command-list -endaccum` 37 38 Apply a binary operation (such as addition or multiplication) to all the 39 images on the stack in a cumulative fashion. The command(s) will be applied 40 to the last and second-to-last images on the stack, then to the result of 41 this operation and the third-to-last image on the stack and so on. Below is 42 the example of using the command to add multiple images. 43 44 c3d image*.nii -accum -add -endaccum -o sum.nii""" 45 46 def run( 47 self, 48 execution: Execution, 49 ) -> list[str]: 50 """ 51 Build command line arguments. This method is called by the main command. 52 53 Args: 54 execution: The execution object. 55 Returns: 56 Command line arguments 57 """ 58 cargs = [] 59 cargs.extend([ 60 "-accum", 61 self.accum 62 ]) 63 return cargs
-accum, -endaccum: Accumulate operations over all images
Syntax: -accum command-list -endaccum
Apply a binary operation (such as addition or multiplication) to all the images on the stack in a cumulative fashion. The command(s) will be applied to the last and second-to-last images on the stack, then to the result of this operation and the third-to-last image on the stack and so on. Below is the example of using the command to add multiple images.
c3d image*.nii -accum -add -endaccum -o sum.nii.
-accum, -endaccum: Accumulate operations over all images
Syntax: -accum command-list -endaccum
Apply a binary operation (such as addition or multiplication) to all the images on the stack in a cumulative fashion. The command(s) will be applied to the last and second-to-last images on the stack, then to the result of this operation and the third-to-last image on the stack and so on. Below is the example of using the command to add multiple images.
c3d image*.nii -accum -add -endaccum -o sum.nii
46 def run( 47 self, 48 execution: Execution, 49 ) -> list[str]: 50 """ 51 Build command line arguments. This method is called by the main command. 52 53 Args: 54 execution: The execution object. 55 Returns: 56 Command line arguments 57 """ 58 cargs = [] 59 cargs.extend([ 60 "-accum", 61 self.accum 62 ]) 63 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
66@dataclasses.dataclass 67class C3dAcos: 68 """ 69 No description found. 70 """ 71 acos: str 72 """No description found.""" 73 74 def run( 75 self, 76 execution: Execution, 77 ) -> list[str]: 78 """ 79 Build command line arguments. This method is called by the main command. 80 81 Args: 82 execution: The execution object. 83 Returns: 84 Command line arguments 85 """ 86 cargs = [] 87 cargs.extend([ 88 "-acos", 89 self.acos 90 ]) 91 return cargs
No description found.
74 def run( 75 self, 76 execution: Execution, 77 ) -> list[str]: 78 """ 79 Build command line arguments. This method is called by the main command. 80 81 Args: 82 execution: The execution object. 83 Returns: 84 Command line arguments 85 """ 86 cargs = [] 87 cargs.extend([ 88 "-acos", 89 self.acos 90 ]) 91 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
94@dataclasses.dataclass 95class C3dAdd: 96 """ 97 -add: Voxelwise image addition 98 99 Syntax: `-add` 100 101 Adds the last two images on the stack, and places the sum at the end of the 102 stack. 103 104 # Add two images: x = a + b 105 c3d a.img b.img -add -o x.img 106 107 # Add three images, x = (a + b) + c in the first example, x = a + (b + c) in 108 the second 109 c3d a.img b.img -add c.img -add -o x.img 110 c3d a.img b.img c.img -add -add -o x.img 111 112 # Subtract two images, using -scale command: x = a - b 113 c3d a.img b.img -scale -1 -add -o x.img. 114 """ 115 add: str 116 """-add: Voxelwise image addition 117 118 Syntax: `-add` 119 120 Adds the last two images on the stack, and places the sum at the end of the 121 stack. 122 123 # Add two images: x = a + b 124 c3d a.img b.img -add -o x.img 125 126 # Add three images, x = (a + b) + c in the first example, x = a + (b + c) in 127 the second 128 c3d a.img b.img -add c.img -add -o x.img 129 c3d a.img b.img c.img -add -add -o x.img 130 131 # Subtract two images, using -scale command: x = a - b 132 c3d a.img b.img -scale -1 -add -o x.img""" 133 134 def run( 135 self, 136 execution: Execution, 137 ) -> list[str]: 138 """ 139 Build command line arguments. This method is called by the main command. 140 141 Args: 142 execution: The execution object. 143 Returns: 144 Command line arguments 145 """ 146 cargs = [] 147 cargs.extend([ 148 "-add", 149 self.add 150 ]) 151 return cargs
-add: Voxelwise image addition
Syntax: -add
Adds the last two images on the stack, and places the sum at the end of the stack.
Add two images: x = a + b
c3d a.img b.img -add -o x.img
Add three images, x = (a + b) + c in the first example, x = a + (b + c) in
the second c3d a.img b.img -add c.img -add -o x.img c3d a.img b.img c.img -add -add -o x.img
Subtract two images, using -scale command: x = a - b
c3d a.img b.img -scale -1 -add -o x.img.
-add: Voxelwise image addition
Syntax: -add
Adds the last two images on the stack, and places the sum at the end of the stack.
Add two images: x = a + b
c3d a.img b.img -add -o x.img
Add three images, x = (a + b) + c in the first example, x = a + (b + c) in
the second c3d a.img b.img -add c.img -add -o x.img c3d a.img b.img c.img -add -add -o x.img
Subtract two images, using -scale command: x = a - b
c3d a.img b.img -scale -1 -add -o x.img
134 def run( 135 self, 136 execution: Execution, 137 ) -> list[str]: 138 """ 139 Build command line arguments. This method is called by the main command. 140 141 Args: 142 execution: The execution object. 143 Returns: 144 Command line arguments 145 """ 146 cargs = [] 147 cargs.extend([ 148 "-add", 149 self.add 150 ]) 151 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
154@dataclasses.dataclass 155class C3dAlignLandmarks: 156 """ 157 -alm, -align-landmarks: Align images based on landmark matching 158 159 Syntax: `-alm dof outfile` 160 161 Performs rigid or affine alignment between to sets of landmark images. A 162 landmark image is an image where for every intensity value, the centroid of 163 all voxels with that intensity represents a landmark. Landmarks can be 164 created using the paintbrush tool in ITK-SNAP (they can be spheres, cubes, 165 etc). The first image on the stack is the target/fixed/reference image, and 166 the second is the moving image. The parameters are the degrees of freedom, 167 which is a number (6 for rigid, 7 for rigid+scale, 12 for affine) and the 168 output matrix file. In this example, we have images **fixed.nii* and 169 **moving.nii** with corresponding landmark images. We use landmarks to align 170 the moving image to the fixed: 171 172 c3d fixed_landmarks.nii moving_landmarks.nii -alm 6 rigid.mat 173 c3d fixed.nii moving.nii -reslice-matrix rigid.mat -o 174 moving_resliced_to_fixed.nii. 175 """ 176 align_landmarks: str 177 """-alm, -align-landmarks: Align images based on landmark matching 178 179 Syntax: `-alm dof outfile` 180 181 Performs rigid or affine alignment between to sets of landmark images. A 182 landmark image is an image where for every intensity value, the centroid of 183 all voxels with that intensity represents a landmark. Landmarks can be 184 created using the paintbrush tool in ITK-SNAP (they can be spheres, cubes, 185 etc). The first image on the stack is the target/fixed/reference image, and 186 the second is the moving image. The parameters are the degrees of freedom, 187 which is a number (6 for rigid, 7 for rigid+scale, 12 for affine) and the 188 output matrix file. In this example, we have images **fixed.nii* and 189 **moving.nii** with corresponding landmark images. We use landmarks to align 190 the moving image to the fixed: 191 192 c3d fixed_landmarks.nii moving_landmarks.nii -alm 6 rigid.mat 193 c3d fixed.nii moving.nii -reslice-matrix rigid.mat -o 194 moving_resliced_to_fixed.nii""" 195 196 def run( 197 self, 198 execution: Execution, 199 ) -> list[str]: 200 """ 201 Build command line arguments. This method is called by the main command. 202 203 Args: 204 execution: The execution object. 205 Returns: 206 Command line arguments 207 """ 208 cargs = [] 209 cargs.extend([ 210 "-align-landmarks", 211 self.align_landmarks 212 ]) 213 return cargs
-alm, -align-landmarks: Align images based on landmark matching
Syntax: -alm dof outfile
Performs rigid or affine alignment between to sets of landmark images. A landmark image is an image where for every intensity value, the centroid of all voxels with that intensity represents a landmark. Landmarks can be created using the paintbrush tool in ITK-SNAP (they can be spheres, cubes, etc). The first image on the stack is the target/fixed/reference image, and the second is the moving image. The parameters are the degrees of freedom, which is a number (6 for rigid, 7 for rigid+scale, 12 for affine) and the output matrix file. In this example, we have images fixed.nii* and **moving.nii with corresponding landmark images. We use landmarks to align the moving image to the fixed:
c3d fixed_landmarks.nii moving_landmarks.nii -alm 6 rigid.mat c3d fixed.nii moving.nii -reslice-matrix rigid.mat -o moving_resliced_to_fixed.nii.
-alm, -align-landmarks: Align images based on landmark matching
Syntax: -alm dof outfile
Performs rigid or affine alignment between to sets of landmark images. A landmark image is an image where for every intensity value, the centroid of all voxels with that intensity represents a landmark. Landmarks can be created using the paintbrush tool in ITK-SNAP (they can be spheres, cubes, etc). The first image on the stack is the target/fixed/reference image, and the second is the moving image. The parameters are the degrees of freedom, which is a number (6 for rigid, 7 for rigid+scale, 12 for affine) and the output matrix file. In this example, we have images fixed.nii* and **moving.nii with corresponding landmark images. We use landmarks to align the moving image to the fixed:
c3d fixed_landmarks.nii moving_landmarks.nii -alm 6 rigid.mat c3d fixed.nii moving.nii -reslice-matrix rigid.mat -o moving_resliced_to_fixed.nii
196 def run( 197 self, 198 execution: Execution, 199 ) -> list[str]: 200 """ 201 Build command line arguments. This method is called by the main command. 202 203 Args: 204 execution: The execution object. 205 Returns: 206 Command line arguments 207 """ 208 cargs = [] 209 cargs.extend([ 210 "-align-landmarks", 211 self.align_landmarks 212 ]) 213 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
216@dataclasses.dataclass 217class C3dAnisotropicDiffusion: 218 """ 219 -add: Voxelwise image addition 220 221 Syntax: `-add` 222 223 Adds the last two images on the stack, and places the sum at the end of the 224 stack. 225 226 # Add two images: x = a + b 227 c3d a.img b.img -add -o x.img 228 229 # Add three images, x = (a + b) + c in the first example, x = a + (b + c) in 230 the second 231 c3d a.img b.img -add c.img -add -o x.img 232 c3d a.img b.img c.img -add -add -o x.img 233 234 # Subtract two images, using -scale command: x = a - b 235 c3d a.img b.img -scale -1 -add -o x.img. 236 """ 237 anisotropic_diffusion: str 238 """-add: Voxelwise image addition 239 240 Syntax: `-add` 241 242 Adds the last two images on the stack, and places the sum at the end of the 243 stack. 244 245 # Add two images: x = a + b 246 c3d a.img b.img -add -o x.img 247 248 # Add three images, x = (a + b) + c in the first example, x = a + (b + c) in 249 the second 250 c3d a.img b.img -add c.img -add -o x.img 251 c3d a.img b.img c.img -add -add -o x.img 252 253 # Subtract two images, using -scale command: x = a - b 254 c3d a.img b.img -scale -1 -add -o x.img""" 255 256 def run( 257 self, 258 execution: Execution, 259 ) -> list[str]: 260 """ 261 Build command line arguments. This method is called by the main command. 262 263 Args: 264 execution: The execution object. 265 Returns: 266 Command line arguments 267 """ 268 cargs = [] 269 cargs.extend([ 270 "-anisotropic-diffusion", 271 self.anisotropic_diffusion 272 ]) 273 return cargs
-add: Voxelwise image addition
Syntax: -add
Adds the last two images on the stack, and places the sum at the end of the stack.
Add two images: x = a + b
c3d a.img b.img -add -o x.img
Add three images, x = (a + b) + c in the first example, x = a + (b + c) in
the second c3d a.img b.img -add c.img -add -o x.img c3d a.img b.img c.img -add -add -o x.img
Subtract two images, using -scale command: x = a - b
c3d a.img b.img -scale -1 -add -o x.img.
-add: Voxelwise image addition
Syntax: -add
Adds the last two images on the stack, and places the sum at the end of the stack.
Add two images: x = a + b
c3d a.img b.img -add -o x.img
Add three images, x = (a + b) + c in the first example, x = a + (b + c) in
the second c3d a.img b.img -add c.img -add -o x.img c3d a.img b.img c.img -add -add -o x.img
Subtract two images, using -scale command: x = a - b
c3d a.img b.img -scale -1 -add -o x.img
256 def run( 257 self, 258 execution: Execution, 259 ) -> list[str]: 260 """ 261 Build command line arguments. This method is called by the main command. 262 263 Args: 264 execution: The execution object. 265 Returns: 266 Command line arguments 267 """ 268 cargs = [] 269 cargs.extend([ 270 "-anisotropic-diffusion", 271 self.anisotropic_diffusion 272 ]) 273 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
276@dataclasses.dataclass 277class C3dAntialias: 278 """ 279 No description found. 280 """ 281 antialias: str 282 """No description found.""" 283 284 def run( 285 self, 286 execution: Execution, 287 ) -> list[str]: 288 """ 289 Build command line arguments. This method is called by the main command. 290 291 Args: 292 execution: The execution object. 293 Returns: 294 Command line arguments 295 """ 296 cargs = [] 297 cargs.extend([ 298 "-antialias", 299 self.antialias 300 ]) 301 return cargs
No description found.
284 def run( 285 self, 286 execution: Execution, 287 ) -> list[str]: 288 """ 289 Build command line arguments. This method is called by the main command. 290 291 Args: 292 execution: The execution object. 293 Returns: 294 Command line arguments 295 """ 296 cargs = [] 297 cargs.extend([ 298 "-antialias", 299 self.antialias 300 ]) 301 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
356@dataclasses.dataclass 357class C3dAsin: 358 """ 359 No description found. 360 """ 361 asin: str 362 """No description found.""" 363 364 def run( 365 self, 366 execution: Execution, 367 ) -> list[str]: 368 """ 369 Build command line arguments. This method is called by the main command. 370 371 Args: 372 execution: The execution object. 373 Returns: 374 Command line arguments 375 """ 376 cargs = [] 377 cargs.extend([ 378 "-asin", 379 self.asin 380 ]) 381 return cargs
No description found.
364 def run( 365 self, 366 execution: Execution, 367 ) -> list[str]: 368 """ 369 Build command line arguments. This method is called by the main command. 370 371 Args: 372 execution: The execution object. 373 Returns: 374 Command line arguments 375 """ 376 cargs = [] 377 cargs.extend([ 378 "-asin", 379 self.asin 380 ]) 381 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
384@dataclasses.dataclass 385class C3dAtan2: 386 """ 387 -atan2: Voxelwise angle from sine and cosine 388 389 Syntax: `-atan2` 390 391 Computes the angle in radians from images containing sine and cosine. This 392 is a voxel-wise operation. It requires two images on the stack (sine 393 followed by cosine): 394 395 c3d sin_theta.nii.gz cos_theta.nii.gz -atan2 -o theta.nii.gz. 396 """ 397 atan2: str 398 """-atan2: Voxelwise angle from sine and cosine 399 400 Syntax: `-atan2` 401 402 Computes the angle in radians from images containing sine and cosine. This 403 is a voxel-wise operation. It requires two images on the stack (sine 404 followed by cosine): 405 406 c3d sin_theta.nii.gz cos_theta.nii.gz -atan2 -o theta.nii.gz""" 407 408 def run( 409 self, 410 execution: Execution, 411 ) -> list[str]: 412 """ 413 Build command line arguments. This method is called by the main command. 414 415 Args: 416 execution: The execution object. 417 Returns: 418 Command line arguments 419 """ 420 cargs = [] 421 cargs.extend([ 422 "-atan2", 423 self.atan2 424 ]) 425 return cargs
-atan2: Voxelwise angle from sine and cosine
Syntax: -atan2
Computes the angle in radians from images containing sine and cosine. This is a voxel-wise operation. It requires two images on the stack (sine followed by cosine):
c3d sin_theta.nii.gz cos_theta.nii.gz -atan2 -o theta.nii.gz.
-atan2: Voxelwise angle from sine and cosine
Syntax: -atan2
Computes the angle in radians from images containing sine and cosine. This is a voxel-wise operation. It requires two images on the stack (sine followed by cosine):
c3d sin_theta.nii.gz cos_theta.nii.gz -atan2 -o theta.nii.gz
408 def run( 409 self, 410 execution: Execution, 411 ) -> list[str]: 412 """ 413 Build command line arguments. This method is called by the main command. 414 415 Args: 416 execution: The execution object. 417 Returns: 418 Command line arguments 419 """ 420 cargs = [] 421 cargs.extend([ 422 "-atan2", 423 self.atan2 424 ]) 425 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
428@dataclasses.dataclass 429class C3dBackground: 430 """ 431 -background: Specify background intensity 432 433 Syntax: `-background <value> ` 434 435 Sets the background intensity for interpolation and other operations where 436 some default background value is needed. Default is 0. 437 """ 438 background: str 439 """-background: Specify background intensity 440 441 Syntax: `-background <value> ` 442 443 Sets the background intensity for interpolation and other operations where 444 some default background value is needed. Default is 0.""" 445 446 def run( 447 self, 448 execution: Execution, 449 ) -> list[str]: 450 """ 451 Build command line arguments. This method is called by the main command. 452 453 Args: 454 execution: The execution object. 455 Returns: 456 Command line arguments 457 """ 458 cargs = [] 459 cargs.extend([ 460 "-background", 461 self.background 462 ]) 463 return cargs
-background: Specify background intensity
Syntax: -background <value>
Sets the background intensity for interpolation and other operations where some default background value is needed. Default is 0.
-background: Specify background intensity
Syntax: -background <value>
Sets the background intensity for interpolation and other operations where some default background value is needed. Default is 0.
446 def run( 447 self, 448 execution: Execution, 449 ) -> list[str]: 450 """ 451 Build command line arguments. This method is called by the main command. 452 453 Args: 454 execution: The execution object. 455 Returns: 456 Command line arguments 457 """ 458 cargs = [] 459 cargs.extend([ 460 "-background", 461 self.background 462 ]) 463 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
510@dataclasses.dataclass 511class C3dBinarize: 512 """ 513 -binarize: Convert image to binary 514 515 Syntax: `-binarize` 516 517 Converts an image to binary by mapping all background values (the background 518 is 0 by default and can be changed by the option **-background**) to 0 and 519 all non-background values to 1. The **-binarize** command is shorthand for 520 the **-threshold** command. 521 522 c3d test.img -binarize -o binary.img 523 c3d -background 10 -binarize -o binary.img 524 c3d test.img -threshold 10 10 0 1 // equivalent to above command. 525 """ 526 binarize: str 527 """-binarize: Convert image to binary 528 529 Syntax: `-binarize` 530 531 Converts an image to binary by mapping all background values (the background 532 is 0 by default and can be changed by the option **-background**) to 0 and 533 all non-background values to 1. The **-binarize** command is shorthand for 534 the **-threshold** command. 535 536 c3d test.img -binarize -o binary.img 537 c3d -background 10 -binarize -o binary.img 538 c3d test.img -threshold 10 10 0 1 // equivalent to above command""" 539 540 def run( 541 self, 542 execution: Execution, 543 ) -> list[str]: 544 """ 545 Build command line arguments. This method is called by the main command. 546 547 Args: 548 execution: The execution object. 549 Returns: 550 Command line arguments 551 """ 552 cargs = [] 553 cargs.extend([ 554 "-binarize", 555 self.binarize 556 ]) 557 return cargs
-binarize: Convert image to binary
Syntax: -binarize
Converts an image to binary by mapping all background values (the background is 0 by default and can be changed by the option -background) to 0 and all non-background values to 1. The -binarize command is shorthand for the -threshold command.
c3d test.img -binarize -o binary.img c3d -background 10 -binarize -o binary.img c3d test.img -threshold 10 10 0 1 // equivalent to above command.
-binarize: Convert image to binary
Syntax: -binarize
Converts an image to binary by mapping all background values (the background is 0 by default and can be changed by the option -background) to 0 and all non-background values to 1. The -binarize command is shorthand for the -threshold command.
c3d test.img -binarize -o binary.img c3d -background 10 -binarize -o binary.img c3d test.img -threshold 10 10 0 1 // equivalent to above command
540 def run( 541 self, 542 execution: Execution, 543 ) -> list[str]: 544 """ 545 Build command line arguments. This method is called by the main command. 546 547 Args: 548 execution: The execution object. 549 Returns: 550 Command line arguments 551 """ 552 cargs = [] 553 cargs.extend([ 554 "-binarize", 555 self.binarize 556 ]) 557 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
560@dataclasses.dataclass 561class C3dCanny: 562 """ 563 -canny: Canny edge detector 564 565 Syntax: `-canny <sigma_vector> <t_lower> <t_upper>` 566 567 Performs edge detection on the last image on the stack using the Canny 568 filter. The parameters are a vector of standard deviations defining the 569 scale of the edges detected and lower and upper thresholds for edge 570 selection. See documentation on the [ITK Canny Filter][14]. 571 """ 572 canny: str 573 """-canny: Canny edge detector 574 575 Syntax: `-canny <sigma_vector> <t_lower> <t_upper>` 576 577 Performs edge detection on the last image on the stack using the Canny 578 filter. The parameters are a vector of standard deviations defining the 579 scale of the edges detected and lower and upper thresholds for edge 580 selection. See documentation on the [ITK Canny Filter][14].""" 581 582 def run( 583 self, 584 execution: Execution, 585 ) -> list[str]: 586 """ 587 Build command line arguments. This method is called by the main command. 588 589 Args: 590 execution: The execution object. 591 Returns: 592 Command line arguments 593 """ 594 cargs = [] 595 cargs.extend([ 596 "-canny", 597 self.canny 598 ]) 599 return cargs
-canny: Canny edge detector
Syntax: -canny <sigma_vector> <t_lower> <t_upper>
Performs edge detection on the last image on the stack using the Canny filter. The parameters are a vector of standard deviations defining the scale of the edges detected and lower and upper thresholds for edge selection. See documentation on the [ITK Canny Filter][14].
-canny: Canny edge detector
Syntax: -canny <sigma_vector> <t_lower> <t_upper>
Performs edge detection on the last image on the stack using the Canny filter. The parameters are a vector of standard deviations defining the scale of the edges detected and lower and upper thresholds for edge selection. See documentation on the [ITK Canny Filter][14].
582 def run( 583 self, 584 execution: Execution, 585 ) -> list[str]: 586 """ 587 Build command line arguments. This method is called by the main command. 588 589 Args: 590 execution: The execution object. 591 Returns: 592 Command line arguments 593 """ 594 cargs = [] 595 cargs.extend([ 596 "-canny", 597 self.canny 598 ]) 599 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
602@dataclasses.dataclass 603class C3dCeil: 604 """ 605 -ceil: Round up image intensities 606 607 Syntax: `-ceil ` 608 609 Each image intensity is replaced by the smallest integer larger or equal to 610 it 611 612 c3d input.img -ceil -o output.img. 613 """ 614 ceil: str 615 """-ceil: Round up image intensities 616 617 Syntax: `-ceil ` 618 619 Each image intensity is replaced by the smallest integer larger or equal to 620 it 621 622 c3d input.img -ceil -o output.img""" 623 624 def run( 625 self, 626 execution: Execution, 627 ) -> list[str]: 628 """ 629 Build command line arguments. This method is called by the main command. 630 631 Args: 632 execution: The execution object. 633 Returns: 634 Command line arguments 635 """ 636 cargs = [] 637 cargs.extend([ 638 "-ceil", 639 self.ceil 640 ]) 641 return cargs
-ceil: Round up image intensities
Syntax: -ceil
Each image intensity is replaced by the smallest integer larger or equal to it
c3d input.img -ceil -o output.img.
-ceil: Round up image intensities
Syntax: -ceil
Each image intensity is replaced by the smallest integer larger or equal to it
c3d input.img -ceil -o output.img
624 def run( 625 self, 626 execution: Execution, 627 ) -> list[str]: 628 """ 629 Build command line arguments. This method is called by the main command. 630 631 Args: 632 execution: The execution object. 633 Returns: 634 Command line arguments 635 """ 636 cargs = [] 637 cargs.extend([ 638 "-ceil", 639 self.ceil 640 ]) 641 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
644@dataclasses.dataclass 645class C3dCentroid: 646 """ 647 -centroid: Report centroid of foreground voxels 648 649 Syntax: `-centroid` 650 651 Reports the centroid, in physical coordinates, of all foreground voxels in 652 the image. 653 654 c3d binaryimage.img -centroid // centroid of all non-0 voxels 655 c3d grayimage.img -thresh 1000 7000 1 0 -centroid 1 // centroid of all 656 voxels in range 1000-7000 657 c3d labelimage.img -thresh 5 5 1 0 -centroid // centroid of all voxels with 658 label 5 659 c3d labelimage.img -split -foreach -centroid -endfor // centroids of all 660 labels (including 0). 661 """ 662 centroid: str 663 """-centroid: Report centroid of foreground voxels 664 665 Syntax: `-centroid` 666 667 Reports the centroid, in physical coordinates, of all foreground voxels in 668 the image. 669 670 c3d binaryimage.img -centroid // centroid of all non-0 voxels 671 c3d grayimage.img -thresh 1000 7000 1 0 -centroid 1 // centroid of all 672 voxels in range 1000-7000 673 c3d labelimage.img -thresh 5 5 1 0 -centroid // centroid of all voxels with 674 label 5 675 c3d labelimage.img -split -foreach -centroid -endfor // centroids of all 676 labels (including 0)""" 677 678 def run( 679 self, 680 execution: Execution, 681 ) -> list[str]: 682 """ 683 Build command line arguments. This method is called by the main command. 684 685 Args: 686 execution: The execution object. 687 Returns: 688 Command line arguments 689 """ 690 cargs = [] 691 cargs.extend([ 692 "-centroid", 693 self.centroid 694 ]) 695 return cargs
-centroid: Report centroid of foreground voxels
Syntax: -centroid
Reports the centroid, in physical coordinates, of all foreground voxels in the image.
c3d binaryimage.img -centroid // centroid of all non-0 voxels c3d grayimage.img -thresh 1000 7000 1 0 -centroid 1 // centroid of all voxels in range 1000-7000 c3d labelimage.img -thresh 5 5 1 0 -centroid // centroid of all voxels with label 5 c3d labelimage.img -split -foreach -centroid -endfor // centroids of all labels (including 0).
-centroid: Report centroid of foreground voxels
Syntax: -centroid
Reports the centroid, in physical coordinates, of all foreground voxels in the image.
c3d binaryimage.img -centroid // centroid of all non-0 voxels c3d grayimage.img -thresh 1000 7000 1 0 -centroid 1 // centroid of all voxels in range 1000-7000 c3d labelimage.img -thresh 5 5 1 0 -centroid // centroid of all voxels with label 5 c3d labelimage.img -split -foreach -centroid -endfor // centroids of all labels (including 0)
678 def run( 679 self, 680 execution: Execution, 681 ) -> list[str]: 682 """ 683 Build command line arguments. This method is called by the main command. 684 685 Args: 686 execution: The execution object. 687 Returns: 688 Command line arguments 689 """ 690 cargs = [] 691 cargs.extend([ 692 "-centroid", 693 self.centroid 694 ]) 695 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
698@dataclasses.dataclass 699class C3dCentroidMark: 700 """ 701 -centroid-mark: Mark the centroid of foreground voxels 702 703 Syntax: `-centroid-mark <label>` 704 705 Marks the centroid of the foreground voxels in an image. Unlike 706 **-centroid**, this command does not print the centroid location, but marks 707 the closest voxel in the image with the intensity **label**. The remaining 708 voxels are assigned 0 intensity. Combined with -dilate, this can be used to 709 mark centers of regions with spheres. 710 711 c3d binaryimage.nii -centroid-mark -dilate 1 3x3x3 712 c3d labelimage.nii -split -foreach -centroid-mark -endfor -merge -o 713 centers.nii. 714 """ 715 centroid_mark: str 716 """-centroid-mark: Mark the centroid of foreground voxels 717 718 Syntax: `-centroid-mark <label>` 719 720 Marks the centroid of the foreground voxels in an image. Unlike 721 **-centroid**, this command does not print the centroid location, but marks 722 the closest voxel in the image with the intensity **label**. The remaining 723 voxels are assigned 0 intensity. Combined with -dilate, this can be used to 724 mark centers of regions with spheres. 725 726 c3d binaryimage.nii -centroid-mark -dilate 1 3x3x3 727 c3d labelimage.nii -split -foreach -centroid-mark -endfor -merge -o 728 centers.nii""" 729 730 def run( 731 self, 732 execution: Execution, 733 ) -> list[str]: 734 """ 735 Build command line arguments. This method is called by the main command. 736 737 Args: 738 execution: The execution object. 739 Returns: 740 Command line arguments 741 """ 742 cargs = [] 743 cargs.extend([ 744 "-centroid-mark", 745 self.centroid_mark 746 ]) 747 return cargs
-centroid-mark: Mark the centroid of foreground voxels
Syntax: -centroid-mark <label>
Marks the centroid of the foreground voxels in an image. Unlike -centroid, this command does not print the centroid location, but marks the closest voxel in the image with the intensity label. The remaining voxels are assigned 0 intensity. Combined with -dilate, this can be used to mark centers of regions with spheres.
c3d binaryimage.nii -centroid-mark -dilate 1 3x3x3 c3d labelimage.nii -split -foreach -centroid-mark -endfor -merge -o centers.nii.
-centroid-mark: Mark the centroid of foreground voxels
Syntax: -centroid-mark <label>
Marks the centroid of the foreground voxels in an image. Unlike -centroid, this command does not print the centroid location, but marks the closest voxel in the image with the intensity label. The remaining voxels are assigned 0 intensity. Combined with -dilate, this can be used to mark centers of regions with spheres.
c3d binaryimage.nii -centroid-mark -dilate 1 3x3x3 c3d labelimage.nii -split -foreach -centroid-mark -endfor -merge -o centers.nii
730 def run( 731 self, 732 execution: Execution, 733 ) -> list[str]: 734 """ 735 Build command line arguments. This method is called by the main command. 736 737 Args: 738 execution: The execution object. 739 Returns: 740 Command line arguments 741 """ 742 cargs = [] 743 cargs.extend([ 744 "-centroid-mark", 745 self.centroid_mark 746 ]) 747 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
800@dataclasses.dataclass 801class C3dClear: 802 """ 803 -clear: Clear the image stack 804 805 Syntax: `-clear` 806 807 Clears the image stack. Images assigned a name with the **-as** command will 808 remain in memory. 809 """ 810 clear_: str 811 """-clear: Clear the image stack 812 813 Syntax: `-clear` 814 815 Clears the image stack. Images assigned a name with the **-as** command will 816 remain in memory.""" 817 818 def run( 819 self, 820 execution: Execution, 821 ) -> list[str]: 822 """ 823 Build command line arguments. This method is called by the main command. 824 825 Args: 826 execution: The execution object. 827 Returns: 828 Command line arguments 829 """ 830 cargs = [] 831 cargs.extend([ 832 "-clear", 833 self.clear_ 834 ]) 835 return cargs
-clear: Clear the image stack
Syntax: -clear
Clears the image stack. Images assigned a name with the -as command will remain in memory.
-clear: Clear the image stack
Syntax: -clear
Clears the image stack. Images assigned a name with the -as command will remain in memory.
818 def run( 819 self, 820 execution: Execution, 821 ) -> list[str]: 822 """ 823 Build command line arguments. This method is called by the main command. 824 825 Args: 826 execution: The execution object. 827 Returns: 828 Command line arguments 829 """ 830 cargs = [] 831 cargs.extend([ 832 "-clear", 833 self.clear_ 834 ]) 835 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
838@dataclasses.dataclass 839class C3dClip: 840 """ 841 -clip: Clip image intensity to range 842 843 Syntax: `-clip iMin iMax` 844 845 Clips image intensities, so that the values below *iMin* are converted to 846 *iMin* and values greater than *iMax* are converted to *iMax*. This is 847 useful for eliminating hyperintensities in images. Values *iMin* and *iMax* 848 are intensity specifications (see below). 849 850 c3d mri.img -clip 1000 8000 -o mriclip01.img // Clips below and above 851 c3d mri.img -clip -inf 8000 -o mriclip02.img // Clips above only 852 c3d mri.img -clip -inf 95% -o mriclip03.img // Clips at 95th percentile. 853 """ 854 clip: str 855 """-clip: Clip image intensity to range 856 857 Syntax: `-clip iMin iMax` 858 859 Clips image intensities, so that the values below *iMin* are converted to 860 *iMin* and values greater than *iMax* are converted to *iMax*. This is 861 useful for eliminating hyperintensities in images. Values *iMin* and *iMax* 862 are intensity specifications (see below). 863 864 c3d mri.img -clip 1000 8000 -o mriclip01.img // Clips below and above 865 c3d mri.img -clip -inf 8000 -o mriclip02.img // Clips above only 866 c3d mri.img -clip -inf 95% -o mriclip03.img // Clips at 95th percentile""" 867 868 def run( 869 self, 870 execution: Execution, 871 ) -> list[str]: 872 """ 873 Build command line arguments. This method is called by the main command. 874 875 Args: 876 execution: The execution object. 877 Returns: 878 Command line arguments 879 """ 880 cargs = [] 881 cargs.extend([ 882 "-clip", 883 self.clip 884 ]) 885 return cargs
-clip: Clip image intensity to range
Syntax: -clip iMin iMax
Clips image intensities, so that the values below iMin are converted to iMin and values greater than iMax are converted to iMax. This is useful for eliminating hyperintensities in images. Values iMin and iMax are intensity specifications (see below).
c3d mri.img -clip 1000 8000 -o mriclip01.img // Clips below and above c3d mri.img -clip -inf 8000 -o mriclip02.img // Clips above only c3d mri.img -clip -inf 95% -o mriclip03.img // Clips at 95th percentile.
-clip: Clip image intensity to range
Syntax: -clip iMin iMax
Clips image intensities, so that the values below iMin are converted to iMin and values greater than iMax are converted to iMax. This is useful for eliminating hyperintensities in images. Values iMin and iMax are intensity specifications (see below).
c3d mri.img -clip 1000 8000 -o mriclip01.img // Clips below and above c3d mri.img -clip -inf 8000 -o mriclip02.img // Clips above only c3d mri.img -clip -inf 95% -o mriclip03.img // Clips at 95th percentile
868 def run( 869 self, 870 execution: Execution, 871 ) -> list[str]: 872 """ 873 Build command line arguments. This method is called by the main command. 874 875 Args: 876 execution: The execution object. 877 Returns: 878 Command line arguments 879 """ 880 cargs = [] 881 cargs.extend([ 882 "-clip", 883 self.clip 884 ]) 885 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
888@dataclasses.dataclass 889class C3dColorMap: 890 """ 891 -color-map, -colormap: Convert scalar image to RGB using color map 892 893 Syntax: `-color-map <ColormapName> [min max]` 894 895 Converts a scalar image to a color (RGB) image using a specified color map. 896 The output of the command are three images, containing the red, green and 897 blue channels of the RGB image. The mapping uses the range of the input 898 image, e.g., using the **jet** color map, the lowest intensity pixel in the 899 image will be mapped to blue, and the highest intesnity pixel will be mapped 900 to red. The admissible color maps are 901 **hot,cool,spring,summer,autumn,winter,copper,jet,hsv,red,green,blue,grey,overunder**. 902 The command can be used with the -omc command to write RGB images. The 903 example below generates a PNG image from a slice in a scalar image. 904 905 c3d scalar.nii.gz -slice z 50% -flip y -color-map jet -type uchar -omc 906 colorslice.png 907 908 By default the full image intensity range is mapped. The optional **min** 909 and **max** parameters can be used to set the range of the color map. 910 911 c3d scalar.nii.gz -slice z 50% -flip y -color-map jet 0 1 -type uchar -omc 912 colorslice.png. 913 """ 914 color_map: str 915 """-color-map, -colormap: Convert scalar image to RGB using color map 916 917 Syntax: `-color-map <ColormapName> [min max]` 918 919 Converts a scalar image to a color (RGB) image using a specified color map. 920 The output of the command are three images, containing the red, green and 921 blue channels of the RGB image. The mapping uses the range of the input 922 image, e.g., using the **jet** color map, the lowest intensity pixel in the 923 image will be mapped to blue, and the highest intesnity pixel will be mapped 924 to red. The admissible color maps are 925 **hot,cool,spring,summer,autumn,winter,copper,jet,hsv,red,green,blue,grey,overunder**. 926 The command can be used with the -omc command to write RGB images. The 927 example below generates a PNG image from a slice in a scalar image. 928 929 c3d scalar.nii.gz -slice z 50% -flip y -color-map jet -type uchar -omc 930 colorslice.png 931 932 By default the full image intensity range is mapped. The optional **min** 933 and **max** parameters can be used to set the range of the color map. 934 935 c3d scalar.nii.gz -slice z 50% -flip y -color-map jet 0 1 -type uchar -omc 936 colorslice.png""" 937 938 def run( 939 self, 940 execution: Execution, 941 ) -> list[str]: 942 """ 943 Build command line arguments. This method is called by the main command. 944 945 Args: 946 execution: The execution object. 947 Returns: 948 Command line arguments 949 """ 950 cargs = [] 951 cargs.extend([ 952 "-colormap", 953 self.color_map 954 ]) 955 return cargs
-color-map, -colormap: Convert scalar image to RGB using color map
Syntax: -color-map <ColormapName> [min max]
Converts a scalar image to a color (RGB) image using a specified color map. The output of the command are three images, containing the red, green and blue channels of the RGB image. The mapping uses the range of the input image, e.g., using the jet color map, the lowest intensity pixel in the image will be mapped to blue, and the highest intesnity pixel will be mapped to red. The admissible color maps are hot,cool,spring,summer,autumn,winter,copper,jet,hsv,red,green,blue,grey,overunder. The command can be used with the -omc command to write RGB images. The example below generates a PNG image from a slice in a scalar image.
c3d scalar.nii.gz -slice z 50% -flip y -color-map jet -type uchar -omc colorslice.png
By default the full image intensity range is mapped. The optional min and max parameters can be used to set the range of the color map.
c3d scalar.nii.gz -slice z 50% -flip y -color-map jet 0 1 -type uchar -omc colorslice.png.
-color-map, -colormap: Convert scalar image to RGB using color map
Syntax: -color-map <ColormapName> [min max]
Converts a scalar image to a color (RGB) image using a specified color map. The output of the command are three images, containing the red, green and blue channels of the RGB image. The mapping uses the range of the input image, e.g., using the jet color map, the lowest intensity pixel in the image will be mapped to blue, and the highest intesnity pixel will be mapped to red. The admissible color maps are hot,cool,spring,summer,autumn,winter,copper,jet,hsv,red,green,blue,grey,overunder. The command can be used with the -omc command to write RGB images. The example below generates a PNG image from a slice in a scalar image.
c3d scalar.nii.gz -slice z 50% -flip y -color-map jet -type uchar -omc colorslice.png
By default the full image intensity range is mapped. The optional min and max parameters can be used to set the range of the color map.
c3d scalar.nii.gz -slice z 50% -flip y -color-map jet 0 1 -type uchar -omc colorslice.png
938 def run( 939 self, 940 execution: Execution, 941 ) -> list[str]: 942 """ 943 Build command line arguments. This method is called by the main command. 944 945 Args: 946 execution: The execution object. 947 Returns: 948 Command line arguments 949 """ 950 cargs = [] 951 cargs.extend([ 952 "-colormap", 953 self.color_map 954 ]) 955 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
958@dataclasses.dataclass 959class C3dCompress: 960 """ 961 -compress, -no-compress: Enable/disable compression for some image files 962 963 Syntax: `-compress` or `-no-compress` 964 965 Turns on compressing for image file formats that support it. For some file 966 formats, like NIFTI (.nii), compression is enabled automatically when the 967 filename includes the **.gz** extension. For other formats, like MetaImage, 968 you need to specify **-compress** to enable compression. The following two 969 commands save the image as compressed NIFTI and MetaImage files: 970 971 c3d input.nii -o output.nii.gz 972 c3d input.nii -compress -o output.mha. 973 """ 974 compress: str 975 """-compress, -no-compress: Enable/disable compression for some image files 976 977 Syntax: `-compress` or `-no-compress` 978 979 Turns on compressing for image file formats that support it. For some file 980 formats, like NIFTI (.nii), compression is enabled automatically when the 981 filename includes the **.gz** extension. For other formats, like MetaImage, 982 you need to specify **-compress** to enable compression. The following two 983 commands save the image as compressed NIFTI and MetaImage files: 984 985 c3d input.nii -o output.nii.gz 986 c3d input.nii -compress -o output.mha""" 987 988 def run( 989 self, 990 execution: Execution, 991 ) -> list[str]: 992 """ 993 Build command line arguments. This method is called by the main command. 994 995 Args: 996 execution: The execution object. 997 Returns: 998 Command line arguments 999 """ 1000 cargs = [] 1001 cargs.extend([ 1002 "-compress", 1003 self.compress 1004 ]) 1005 return cargs
-compress, -no-compress: Enable/disable compression for some image files
Syntax: -compress or -no-compress
Turns on compressing for image file formats that support it. For some file formats, like NIFTI (.nii), compression is enabled automatically when the filename includes the .gz extension. For other formats, like MetaImage, you need to specify -compress to enable compression. The following two commands save the image as compressed NIFTI and MetaImage files:
c3d input.nii -o output.nii.gz c3d input.nii -compress -o output.mha.
-compress, -no-compress: Enable/disable compression for some image files
Syntax: -compress or -no-compress
Turns on compressing for image file formats that support it. For some file formats, like NIFTI (.nii), compression is enabled automatically when the filename includes the .gz extension. For other formats, like MetaImage, you need to specify -compress to enable compression. The following two commands save the image as compressed NIFTI and MetaImage files:
c3d input.nii -o output.nii.gz c3d input.nii -compress -o output.mha
988 def run( 989 self, 990 execution: Execution, 991 ) -> list[str]: 992 """ 993 Build command line arguments. This method is called by the main command. 994 995 Args: 996 execution: The execution object. 997 Returns: 998 Command line arguments 999 """ 1000 cargs = [] 1001 cargs.extend([ 1002 "-compress", 1003 self.compress 1004 ]) 1005 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
750@dataclasses.dataclass 751class C3dConnectedComponents: 752 """ 753 -comp, -connected-components: Compute connected components 754 755 Syntax: `-comp` 756 757 Computes the connected components of a binary image. Each connected 758 component is assigned an integer index. Indices are ordered by the size of 759 the component, so the component assigned index 1 is the largest. The 760 background is assigned index 0. To select the largest connected component, 761 combine the call to **-comp** with a call to **-threshold**. 762 763 c3d binary.img -comp -o comp.img 764 c3d binary.img -comp -threshold 1 1 1 0 -o largest_comp.img. 765 """ 766 connected_components: str 767 """-comp, -connected-components: Compute connected components 768 769 Syntax: `-comp` 770 771 Computes the connected components of a binary image. Each connected 772 component is assigned an integer index. Indices are ordered by the size of 773 the component, so the component assigned index 1 is the largest. The 774 background is assigned index 0. To select the largest connected component, 775 combine the call to **-comp** with a call to **-threshold**. 776 777 c3d binary.img -comp -o comp.img 778 c3d binary.img -comp -threshold 1 1 1 0 -o largest_comp.img""" 779 780 def run( 781 self, 782 execution: Execution, 783 ) -> list[str]: 784 """ 785 Build command line arguments. This method is called by the main command. 786 787 Args: 788 execution: The execution object. 789 Returns: 790 Command line arguments 791 """ 792 cargs = [] 793 cargs.extend([ 794 "-connected-components", 795 self.connected_components 796 ]) 797 return cargs
-comp, -connected-components: Compute connected components
Syntax: -comp
Computes the connected components of a binary image. Each connected component is assigned an integer index. Indices are ordered by the size of the component, so the component assigned index 1 is the largest. The background is assigned index 0. To select the largest connected component, combine the call to -comp with a call to -threshold.
c3d binary.img -comp -o comp.img c3d binary.img -comp -threshold 1 1 1 0 -o largest_comp.img.
-comp, -connected-components: Compute connected components
Syntax: -comp
Computes the connected components of a binary image. Each connected component is assigned an integer index. Indices are ordered by the size of the component, so the component assigned index 1 is the largest. The background is assigned index 0. To select the largest connected component, combine the call to -comp with a call to -threshold.
c3d binary.img -comp -o comp.img c3d binary.img -comp -threshold 1 1 1 0 -o largest_comp.img
780 def run( 781 self, 782 execution: Execution, 783 ) -> list[str]: 784 """ 785 Build command line arguments. This method is called by the main command. 786 787 Args: 788 execution: The execution object. 789 Returns: 790 Command line arguments 791 """ 792 cargs = [] 793 cargs.extend([ 794 "-connected-components", 795 self.connected_components 796 ]) 797 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1058@dataclasses.dataclass 1059class C3dConv: 1060 """ 1061 -conv: Convolution 1062 1063 Syntax `-conv` 1064 1065 Performs convolution between the last two images on the stack. The 1066 convolution is performed using the Fourier transform. The result is an image 1067 of the same dimensions as the first image. For more details, see ["FFT Based 1068 Convolution" by Gaetan Lehmann][Lehmann]. 1069 1070 c3d image.nii kernel.nii -conv -o result.nii 1071 1072 1073 [Lehmann]: https://hdl.handle.net/10380/3154. 1074 """ 1075 conv: str 1076 """-conv: Convolution 1077 1078 Syntax `-conv` 1079 1080 Performs convolution between the last two images on the stack. The 1081 convolution is performed using the Fourier transform. The result is an image 1082 of the same dimensions as the first image. For more details, see ["FFT Based 1083 Convolution" by Gaetan Lehmann][Lehmann]. 1084 1085 c3d image.nii kernel.nii -conv -o result.nii 1086 1087 1088 [Lehmann]: https://hdl.handle.net/10380/3154""" 1089 1090 def run( 1091 self, 1092 execution: Execution, 1093 ) -> list[str]: 1094 """ 1095 Build command line arguments. This method is called by the main command. 1096 1097 Args: 1098 execution: The execution object. 1099 Returns: 1100 Command line arguments 1101 """ 1102 cargs = [] 1103 cargs.extend([ 1104 "-conv", 1105 self.conv 1106 ]) 1107 return cargs
-conv: Convolution
Syntax -conv
Performs convolution between the last two images on the stack. The convolution is performed using the Fourier transform. The result is an image of the same dimensions as the first image. For more details, see "FFT Based Convolution" by Gaetan Lehmann.
c3d image.nii kernel.nii -conv -o result.nii
-conv: Convolution
Syntax -conv
Performs convolution between the last two images on the stack. The convolution is performed using the Fourier transform. The result is an image of the same dimensions as the first image. For more details, see "FFT Based Convolution" by Gaetan Lehmann.
c3d image.nii kernel.nii -conv -o result.nii
1090 def run( 1091 self, 1092 execution: Execution, 1093 ) -> list[str]: 1094 """ 1095 Build command line arguments. This method is called by the main command. 1096 1097 Args: 1098 execution: The execution object. 1099 Returns: 1100 Command line arguments 1101 """ 1102 cargs = [] 1103 cargs.extend([ 1104 "-conv", 1105 self.conv 1106 ]) 1107 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1172@dataclasses.dataclass 1173class C3dCoordinateMapPhysical: 1174 """ 1175 -cmp, -coordinate-map-physical: Generate voxel coordinate maps (voxel units) 1176 1177 Syntax: `-cmp` 1178 1179 This command is similar to **-cmv** (**-coordinate-map-voxel**), but the 1180 output will contain the physical coordinates of the voxels, in the NIFTI 1181 (RAS) coordinate frame. 1182 """ 1183 coordinate_map_physical: str 1184 """-cmp, -coordinate-map-physical: Generate voxel coordinate maps (voxel 1185 units) 1186 1187 Syntax: `-cmp` 1188 1189 This command is similar to **-cmv** (**-coordinate-map-voxel**), but the 1190 output will contain the physical coordinates of the voxels, in the NIFTI 1191 (RAS) coordinate frame.""" 1192 1193 def run( 1194 self, 1195 execution: Execution, 1196 ) -> list[str]: 1197 """ 1198 Build command line arguments. This method is called by the main command. 1199 1200 Args: 1201 execution: The execution object. 1202 Returns: 1203 Command line arguments 1204 """ 1205 cargs = [] 1206 cargs.extend([ 1207 "-coordinate-map-physical", 1208 self.coordinate_map_physical 1209 ]) 1210 return cargs
-cmp, -coordinate-map-physical: Generate voxel coordinate maps (voxel units)
Syntax: -cmp
This command is similar to -cmv (-coordinate-map-voxel), but the output will contain the physical coordinates of the voxels, in the NIFTI (RAS) coordinate frame.
-cmp, -coordinate-map-physical: Generate voxel coordinate maps (voxel units)
Syntax: -cmp
This command is similar to -cmv (-coordinate-map-voxel), but the output will contain the physical coordinates of the voxels, in the NIFTI (RAS) coordinate frame.
1193 def run( 1194 self, 1195 execution: Execution, 1196 ) -> list[str]: 1197 """ 1198 Build command line arguments. This method is called by the main command. 1199 1200 Args: 1201 execution: The execution object. 1202 Returns: 1203 Command line arguments 1204 """ 1205 cargs = [] 1206 cargs.extend([ 1207 "-coordinate-map-physical", 1208 self.coordinate_map_physical 1209 ]) 1210 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1110@dataclasses.dataclass 1111class C3dCoordinateMapVoxel: 1112 """ 1113 -cmv, -coordinate-map-voxel: Generate voxel coordinate maps (voxel units) 1114 1115 Syntax: `-cmv` 1116 1117 For a *N*-dimensional image, replaces the last image on the stack with *N* 1118 images. The *k*-th output image at each voxel contains the $k$-th coordinate 1119 of that voxel, in voxel units. 1120 1121 c3d image.nii -cmv -oo coordmap%d.nii.gz 1122 1123 One can use this command to split a brain segmentation image into a left 1124 hemisphere segmentation and a right hemisphere segmentation (assuming the X 1125 coordinate corresponds to the right-left axis) 1126 1127 c3d seg.nii -as SEG -cmv -pop -pop -thresh 50% inf 1 0 -as MASK \ 1128 -push SEG -times -o seg_left.nii.gz \ 1129 -push MASK -replace 1 0 0 1 \ 1130 -push SEG -times -o seg_right.nii.gz. 1131 """ 1132 coordinate_map_voxel: str 1133 """-cmv, -coordinate-map-voxel: Generate voxel coordinate maps (voxel units) 1134 1135 Syntax: `-cmv` 1136 1137 For a *N*-dimensional image, replaces the last image on the stack with *N* 1138 images. The *k*-th output image at each voxel contains the $k$-th coordinate 1139 of that voxel, in voxel units. 1140 1141 c3d image.nii -cmv -oo coordmap%d.nii.gz 1142 1143 One can use this command to split a brain segmentation image into a left 1144 hemisphere segmentation and a right hemisphere segmentation (assuming the X 1145 coordinate corresponds to the right-left axis) 1146 1147 c3d seg.nii -as SEG -cmv -pop -pop -thresh 50% inf 1 0 -as MASK \ 1148 -push SEG -times -o seg_left.nii.gz \ 1149 -push MASK -replace 1 0 0 1 \ 1150 -push SEG -times -o seg_right.nii.gz""" 1151 1152 def run( 1153 self, 1154 execution: Execution, 1155 ) -> list[str]: 1156 """ 1157 Build command line arguments. This method is called by the main command. 1158 1159 Args: 1160 execution: The execution object. 1161 Returns: 1162 Command line arguments 1163 """ 1164 cargs = [] 1165 cargs.extend([ 1166 "-coordinate-map-voxel", 1167 self.coordinate_map_voxel 1168 ]) 1169 return cargs
-cmv, -coordinate-map-voxel: Generate voxel coordinate maps (voxel units)
Syntax: -cmv
For a N-dimensional image, replaces the last image on the stack with N images. The k-th output image at each voxel contains the $k$-th coordinate of that voxel, in voxel units.
c3d image.nii -cmv -oo coordmap%d.nii.gz
One can use this command to split a brain segmentation image into a left hemisphere segmentation and a right hemisphere segmentation (assuming the X coordinate corresponds to the right-left axis)
c3d seg.nii -as SEG -cmv -pop -pop -thresh 50% inf 1 0 -as MASK -push SEG -times -o seg_left.nii.gz -push MASK -replace 1 0 0 1 -push SEG -times -o seg_right.nii.gz.
-cmv, -coordinate-map-voxel: Generate voxel coordinate maps (voxel units)
Syntax: -cmv
For a N-dimensional image, replaces the last image on the stack with N images. The k-th output image at each voxel contains the $k$-th coordinate of that voxel, in voxel units.
c3d image.nii -cmv -oo coordmap%d.nii.gz
One can use this command to split a brain segmentation image into a left hemisphere segmentation and a right hemisphere segmentation (assuming the X coordinate corresponds to the right-left axis)
c3d seg.nii -as SEG -cmv -pop -pop -thresh 50% inf 1 0 -as MASK -push SEG -times -o seg_left.nii.gz -push MASK -replace 1 0 0 1 -push SEG -times -o seg_right.nii.gz
1152 def run( 1153 self, 1154 execution: Execution, 1155 ) -> list[str]: 1156 """ 1157 Build command line arguments. This method is called by the main command. 1158 1159 Args: 1160 execution: The execution object. 1161 Returns: 1162 Command line arguments 1163 """ 1164 cargs = [] 1165 cargs.extend([ 1166 "-coordinate-map-voxel", 1167 self.coordinate_map_voxel 1168 ]) 1169 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1213@dataclasses.dataclass 1214class C3dCopyTransform: 1215 """ 1216 -copy-transform: Copy header information 1217 1218 Syntax: `-copy-transform` 1219 1220 Copies the image header, specifically the image to physical space transform 1221 (origin, spacing, direction cosines), from the first image (reference) to 1222 the second image (target). This is best done with NIFTI images, which store 1223 this information well. In the example below, *out.nii* will have the same 1224 header as *first.nii* and the same intensities as *second.nii*. 1225 1226 c3d first.nii second.nii -copy-transform -o out.nii. 1227 """ 1228 copy_transform: str 1229 """-copy-transform: Copy header information 1230 1231 Syntax: `-copy-transform` 1232 1233 Copies the image header, specifically the image to physical space transform 1234 (origin, spacing, direction cosines), from the first image (reference) to 1235 the second image (target). This is best done with NIFTI images, which store 1236 this information well. In the example below, *out.nii* will have the same 1237 header as *first.nii* and the same intensities as *second.nii*. 1238 1239 c3d first.nii second.nii -copy-transform -o out.nii""" 1240 1241 def run( 1242 self, 1243 execution: Execution, 1244 ) -> list[str]: 1245 """ 1246 Build command line arguments. This method is called by the main command. 1247 1248 Args: 1249 execution: The execution object. 1250 Returns: 1251 Command line arguments 1252 """ 1253 cargs = [] 1254 cargs.extend([ 1255 "-copy-transform", 1256 self.copy_transform 1257 ]) 1258 return cargs
-copy-transform: Copy header information
Syntax: -copy-transform
Copies the image header, specifically the image to physical space transform (origin, spacing, direction cosines), from the first image (reference) to the second image (target). This is best done with NIFTI images, which store this information well. In the example below, out.nii will have the same header as first.nii and the same intensities as second.nii.
c3d first.nii second.nii -copy-transform -o out.nii.
-copy-transform: Copy header information
Syntax: -copy-transform
Copies the image header, specifically the image to physical space transform (origin, spacing, direction cosines), from the first image (reference) to the second image (target). This is best done with NIFTI images, which store this information well. In the example below, out.nii will have the same header as first.nii and the same intensities as second.nii.
c3d first.nii second.nii -copy-transform -o out.nii
1241 def run( 1242 self, 1243 execution: Execution, 1244 ) -> list[str]: 1245 """ 1246 Build command line arguments. This method is called by the main command. 1247 1248 Args: 1249 execution: The execution object. 1250 Returns: 1251 Command line arguments 1252 """ 1253 cargs = [] 1254 cargs.extend([ 1255 "-copy-transform", 1256 self.copy_transform 1257 ]) 1258 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1261@dataclasses.dataclass 1262class C3dCos: 1263 """ 1264 No description found. 1265 """ 1266 cos: str 1267 """No description found.""" 1268 1269 def run( 1270 self, 1271 execution: Execution, 1272 ) -> list[str]: 1273 """ 1274 Build command line arguments. This method is called by the main command. 1275 1276 Args: 1277 execution: The execution object. 1278 Returns: 1279 Command line arguments 1280 """ 1281 cargs = [] 1282 cargs.extend([ 1283 "-cos", 1284 self.cos 1285 ]) 1286 return cargs
No description found.
1269 def run( 1270 self, 1271 execution: Execution, 1272 ) -> list[str]: 1273 """ 1274 Build command line arguments. This method is called by the main command. 1275 1276 Args: 1277 execution: The execution object. 1278 Returns: 1279 Command line arguments 1280 """ 1281 cargs = [] 1282 cargs.extend([ 1283 "-cos", 1284 self.cos 1285 ]) 1286 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1289@dataclasses.dataclass 1290class C3dCreate: 1291 """ 1292 -create: Generate blank image 1293 1294 Syntax: `-create dimensions voxel_size` 1295 1296 Creates a new blank image with specified dimensions and voxel size, and 1297 places it at the end of the stack. The image is set to the current 1298 background value, which is 0 by default but can be overwritten with the 1299 **-background** command. The origin of the image can be changed with the 1300 **-origin** command. 1301 1302 c3d -create 256x256x160 1x1x1mm -o newimage.img 1303 c3d -background 128 -create 256x256x160 1x1x1mm -origin 128x128x80mm -o 1304 newimage.img. 1305 """ 1306 create: str 1307 """-create: Generate blank image 1308 1309 Syntax: `-create dimensions voxel_size` 1310 1311 Creates a new blank image with specified dimensions and voxel size, and 1312 places it at the end of the stack. The image is set to the current 1313 background value, which is 0 by default but can be overwritten with the 1314 **-background** command. The origin of the image can be changed with the 1315 **-origin** command. 1316 1317 c3d -create 256x256x160 1x1x1mm -o newimage.img 1318 c3d -background 128 -create 256x256x160 1x1x1mm -origin 128x128x80mm -o 1319 newimage.img""" 1320 1321 def run( 1322 self, 1323 execution: Execution, 1324 ) -> list[str]: 1325 """ 1326 Build command line arguments. This method is called by the main command. 1327 1328 Args: 1329 execution: The execution object. 1330 Returns: 1331 Command line arguments 1332 """ 1333 cargs = [] 1334 cargs.extend([ 1335 "-create", 1336 self.create 1337 ]) 1338 return cargs
-create: Generate blank image
Syntax: -create dimensions voxel_size
Creates a new blank image with specified dimensions and voxel size, and places it at the end of the stack. The image is set to the current background value, which is 0 by default but can be overwritten with the -background command. The origin of the image can be changed with the -origin command.
c3d -create 256x256x160 1x1x1mm -o newimage.img c3d -background 128 -create 256x256x160 1x1x1mm -origin 128x128x80mm -o newimage.img.
-create: Generate blank image
Syntax: -create dimensions voxel_size
Creates a new blank image with specified dimensions and voxel size, and places it at the end of the stack. The image is set to the current background value, which is 0 by default but can be overwritten with the -background command. The origin of the image can be changed with the -origin command.
c3d -create 256x256x160 1x1x1mm -o newimage.img c3d -background 128 -create 256x256x160 1x1x1mm -origin 128x128x80mm -o newimage.img
1321 def run( 1322 self, 1323 execution: Execution, 1324 ) -> list[str]: 1325 """ 1326 Build command line arguments. This method is called by the main command. 1327 1328 Args: 1329 execution: The execution object. 1330 Returns: 1331 Command line arguments 1332 """ 1333 cargs = [] 1334 cargs.extend([ 1335 "-create", 1336 self.create 1337 ]) 1338 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1341@dataclasses.dataclass 1342class C3dDicomSeriesList: 1343 """ 1344 -dicom-series-list: List image series in a DICOM directory 1345 1346 Syntax: `-dicom-series-list <directory> 1347 1348 Prints out a table of DICOM series ids and corresponding image information 1349 to standard output. 1350 """ 1351 dicom_series_list: str 1352 """-dicom-series-list: List image series in a DICOM directory 1353 1354 Syntax: `-dicom-series-list <directory> 1355 1356 Prints out a table of DICOM series ids and corresponding image information 1357 to standard output.""" 1358 1359 def run( 1360 self, 1361 execution: Execution, 1362 ) -> list[str]: 1363 """ 1364 Build command line arguments. This method is called by the main command. 1365 1366 Args: 1367 execution: The execution object. 1368 Returns: 1369 Command line arguments 1370 """ 1371 cargs = [] 1372 cargs.extend([ 1373 "-dicom-series-list", 1374 self.dicom_series_list 1375 ]) 1376 return cargs
-dicom-series-list: List image series in a DICOM directory
Syntax: `-dicom-series-list
Prints out a table of DICOM series ids and corresponding image information to standard output.
-dicom-series-list: List image series in a DICOM directory
Syntax: `-dicom-series-list
Prints out a table of DICOM series ids and corresponding image information to standard output.
1359 def run( 1360 self, 1361 execution: Execution, 1362 ) -> list[str]: 1363 """ 1364 Build command line arguments. This method is called by the main command. 1365 1366 Args: 1367 execution: The execution object. 1368 Returns: 1369 Command line arguments 1370 """ 1371 cargs = [] 1372 cargs.extend([ 1373 "-dicom-series-list", 1374 self.dicom_series_list 1375 ]) 1376 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1379@dataclasses.dataclass 1380class C3dDicomSeriesRead: 1381 """ 1382 -dicom-series-read: Read a DICOM image series 1383 1384 Syntax: `-dicom-series-read <directory> <series_id>` 1385 1386 Imports a specific DICOM image series from a directory containing DICOM 1387 files. The **directory** parameter may also point to one of the DICOM files 1388 in the directory. 1389 The **seried_id** is a string identifier for the series that can be obtained 1390 by calling **-dicom-series-list**. 1391 """ 1392 dicom_series_read: str 1393 """-dicom-series-read: Read a DICOM image series 1394 1395 Syntax: `-dicom-series-read <directory> <series_id>` 1396 1397 Imports a specific DICOM image series from a directory containing DICOM 1398 files. The **directory** parameter may also point to one of the DICOM files 1399 in the directory. 1400 The **seried_id** is a string identifier for the series that can be obtained 1401 by calling **-dicom-series-list**""" 1402 1403 def run( 1404 self, 1405 execution: Execution, 1406 ) -> list[str]: 1407 """ 1408 Build command line arguments. This method is called by the main command. 1409 1410 Args: 1411 execution: The execution object. 1412 Returns: 1413 Command line arguments 1414 """ 1415 cargs = [] 1416 cargs.extend([ 1417 "-dicom-series-read", 1418 self.dicom_series_read 1419 ]) 1420 return cargs
-dicom-series-read: Read a DICOM image series
Syntax: -dicom-series-read <directory> <series_id>
Imports a specific DICOM image series from a directory containing DICOM files. The directory parameter may also point to one of the DICOM files in the directory. The seried_id is a string identifier for the series that can be obtained by calling -dicom-series-list.
-dicom-series-read: Read a DICOM image series
Syntax: -dicom-series-read <directory> <series_id>
Imports a specific DICOM image series from a directory containing DICOM files. The directory parameter may also point to one of the DICOM files in the directory. The seried_id is a string identifier for the series that can be obtained by calling -dicom-series-list
1403 def run( 1404 self, 1405 execution: Execution, 1406 ) -> list[str]: 1407 """ 1408 Build command line arguments. This method is called by the main command. 1409 1410 Args: 1411 execution: The execution object. 1412 Returns: 1413 Command line arguments 1414 """ 1415 cargs = [] 1416 cargs.extend([ 1417 "-dicom-series-read", 1418 self.dicom_series_read 1419 ]) 1420 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1423@dataclasses.dataclass 1424class C3dDilate: 1425 """ 1426 -dilate: Binary dilation 1427 1428 Syntax: `-dilate <label> <radius_vector>` 1429 1430 Applies the dilation [mathematical morphology][5] operation to a binary 1431 image. The first parameter is the intensity value of the object that is to 1432 be dilated. The second is the radius of the dilation structuring element in 1433 3D. 1434 1435 c3d binary.img -dilate 255 3x3x3vox -o newimage.img. 1436 """ 1437 dilate: str 1438 """-dilate: Binary dilation 1439 1440 Syntax: `-dilate <label> <radius_vector>` 1441 1442 Applies the dilation [mathematical morphology][5] operation to a binary 1443 image. The first parameter is the intensity value of the object that is to 1444 be dilated. The second is the radius of the dilation structuring element in 1445 3D. 1446 1447 c3d binary.img -dilate 255 3x3x3vox -o newimage.img""" 1448 1449 def run( 1450 self, 1451 execution: Execution, 1452 ) -> list[str]: 1453 """ 1454 Build command line arguments. This method is called by the main command. 1455 1456 Args: 1457 execution: The execution object. 1458 Returns: 1459 Command line arguments 1460 """ 1461 cargs = [] 1462 cargs.extend([ 1463 "-dilate", 1464 self.dilate 1465 ]) 1466 return cargs
-dilate: Binary dilation
Syntax: -dilate <label> <radius_vector>
Applies the dilation [mathematical morphology][5] operation to a binary image. The first parameter is the intensity value of the object that is to be dilated. The second is the radius of the dilation structuring element in 3D.
c3d binary.img -dilate 255 3x3x3vox -o newimage.img.
-dilate: Binary dilation
Syntax: -dilate <label> <radius_vector>
Applies the dilation [mathematical morphology][5] operation to a binary image. The first parameter is the intensity value of the object that is to be dilated. The second is the radius of the dilation structuring element in 3D.
c3d binary.img -dilate 255 3x3x3vox -o newimage.img
1449 def run( 1450 self, 1451 execution: Execution, 1452 ) -> list[str]: 1453 """ 1454 Build command line arguments. This method is called by the main command. 1455 1456 Args: 1457 execution: The execution object. 1458 Returns: 1459 Command line arguments 1460 """ 1461 cargs = [] 1462 cargs.extend([ 1463 "-dilate", 1464 self.dilate 1465 ]) 1466 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1469@dataclasses.dataclass 1470class C3dDivide: 1471 """ 1472 -divide: Voxelwise image division 1473 1474 Syntax: `-divide` 1475 1476 Divides one image by another. For instance to compute C = A / B, use the 1477 command 1478 1479 c3d A.img B.img -divide -o C.img 1480 1481 Divison may generate infinite and not-a-number (NaN) values if B contains 1482 zeros. You can use **-replace** to get rid of these values 1483 1484 c3d A.img B.img -divide -replace inf 1000 -inf -1000 NaN 0 -o C2.img. 1485 """ 1486 divide: str 1487 """-divide: Voxelwise image division 1488 1489 Syntax: `-divide` 1490 1491 Divides one image by another. For instance to compute C = A / B, use the 1492 command 1493 1494 c3d A.img B.img -divide -o C.img 1495 1496 Divison may generate infinite and not-a-number (NaN) values if B contains 1497 zeros. You can use **-replace** to get rid of these values 1498 1499 c3d A.img B.img -divide -replace inf 1000 -inf -1000 NaN 0 -o C2.img""" 1500 1501 def run( 1502 self, 1503 execution: Execution, 1504 ) -> list[str]: 1505 """ 1506 Build command line arguments. This method is called by the main command. 1507 1508 Args: 1509 execution: The execution object. 1510 Returns: 1511 Command line arguments 1512 """ 1513 cargs = [] 1514 cargs.extend([ 1515 "-divide", 1516 self.divide 1517 ]) 1518 return cargs
-divide: Voxelwise image division
Syntax: -divide
Divides one image by another. For instance to compute C = A / B, use the command
c3d A.img B.img -divide -o C.img
Divison may generate infinite and not-a-number (NaN) values if B contains zeros. You can use -replace to get rid of these values
c3d A.img B.img -divide -replace inf 1000 -inf -1000 NaN 0 -o C2.img.
-divide: Voxelwise image division
Syntax: -divide
Divides one image by another. For instance to compute C = A / B, use the command
c3d A.img B.img -divide -o C.img
Divison may generate infinite and not-a-number (NaN) values if B contains zeros. You can use -replace to get rid of these values
c3d A.img B.img -divide -replace inf 1000 -inf -1000 NaN 0 -o C2.img
1501 def run( 1502 self, 1503 execution: Execution, 1504 ) -> list[str]: 1505 """ 1506 Build command line arguments. This method is called by the main command. 1507 1508 Args: 1509 execution: The execution object. 1510 Returns: 1511 Command line arguments 1512 """ 1513 cargs = [] 1514 cargs.extend([ 1515 "-divide", 1516 self.divide 1517 ]) 1518 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1521@dataclasses.dataclass 1522class C3dDuplicate: 1523 """ 1524 -dup: Duplicate the last image on the stack 1525 1526 Syntax: `-dup` 1527 1528 Duplicates the image at the end of the stack. This is equivalent to **-as 1529 var -push var**, but shorter. An example is when you want to pass an image 1530 as both arguments to a binary operator, e.g., computing the square of the 1531 image intensity: 1532 1533 c3d input.img -dup -times -o square.img 1534 1535 ### Commands: Voxelwise Calculations. 1536 """ 1537 duplicate: str 1538 """-dup: Duplicate the last image on the stack 1539 1540 Syntax: `-dup` 1541 1542 Duplicates the image at the end of the stack. This is equivalent to **-as 1543 var -push var**, but shorter. An example is when you want to pass an image 1544 as both arguments to a binary operator, e.g., computing the square of the 1545 image intensity: 1546 1547 c3d input.img -dup -times -o square.img 1548 1549 ### Commands: Voxelwise Calculations""" 1550 1551 def run( 1552 self, 1553 execution: Execution, 1554 ) -> list[str]: 1555 """ 1556 Build command line arguments. This method is called by the main command. 1557 1558 Args: 1559 execution: The execution object. 1560 Returns: 1561 Command line arguments 1562 """ 1563 cargs = [] 1564 cargs.extend([ 1565 "-dup", 1566 self.duplicate 1567 ]) 1568 return cargs
-dup: Duplicate the last image on the stack
Syntax: -dup
Duplicates the image at the end of the stack. This is equivalent to -as var -push var, but shorter. An example is when you want to pass an image as both arguments to a binary operator, e.g., computing the square of the image intensity:
c3d input.img -dup -times -o square.img
Commands: Voxelwise Calculations.
-dup: Duplicate the last image on the stack
Syntax: -dup
Duplicates the image at the end of the stack. This is equivalent to -as var -push var, but shorter. An example is when you want to pass an image as both arguments to a binary operator, e.g., computing the square of the image intensity:
c3d input.img -dup -times -o square.img
Commands: Voxelwise Calculations
1551 def run( 1552 self, 1553 execution: Execution, 1554 ) -> list[str]: 1555 """ 1556 Build command line arguments. This method is called by the main command. 1557 1558 Args: 1559 execution: The execution object. 1560 Returns: 1561 Command line arguments 1562 """ 1563 cargs = [] 1564 cargs.extend([ 1565 "-dup", 1566 self.duplicate 1567 ]) 1568 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1571@dataclasses.dataclass 1572class C3dEndaccum: 1573 """ 1574 -accum, -endaccum: Accumulate operations over all images 1575 1576 Syntax: `-accum command-list -endaccum` 1577 1578 Apply a binary operation (such as addition or multiplication) to all the 1579 images on the stack in a cumulative fashion. The command(s) will be applied 1580 to the last and second-to-last images on the stack, then to the result of 1581 this operation and the third-to-last image on the stack and so on. Below is 1582 the example of using the command to add multiple images. 1583 1584 c3d image*.nii -accum -add -endaccum -o sum.nii. 1585 """ 1586 endaccum: str 1587 """-accum, -endaccum: Accumulate operations over all images 1588 1589 Syntax: `-accum command-list -endaccum` 1590 1591 Apply a binary operation (such as addition or multiplication) to all the 1592 images on the stack in a cumulative fashion. The command(s) will be applied 1593 to the last and second-to-last images on the stack, then to the result of 1594 this operation and the third-to-last image on the stack and so on. Below is 1595 the example of using the command to add multiple images. 1596 1597 c3d image*.nii -accum -add -endaccum -o sum.nii""" 1598 1599 def run( 1600 self, 1601 execution: Execution, 1602 ) -> list[str]: 1603 """ 1604 Build command line arguments. This method is called by the main command. 1605 1606 Args: 1607 execution: The execution object. 1608 Returns: 1609 Command line arguments 1610 """ 1611 cargs = [] 1612 cargs.extend([ 1613 "-endaccum", 1614 self.endaccum 1615 ]) 1616 return cargs
-accum, -endaccum: Accumulate operations over all images
Syntax: -accum command-list -endaccum
Apply a binary operation (such as addition or multiplication) to all the images on the stack in a cumulative fashion. The command(s) will be applied to the last and second-to-last images on the stack, then to the result of this operation and the third-to-last image on the stack and so on. Below is the example of using the command to add multiple images.
c3d image*.nii -accum -add -endaccum -o sum.nii.
-accum, -endaccum: Accumulate operations over all images
Syntax: -accum command-list -endaccum
Apply a binary operation (such as addition or multiplication) to all the images on the stack in a cumulative fashion. The command(s) will be applied to the last and second-to-last images on the stack, then to the result of this operation and the third-to-last image on the stack and so on. Below is the example of using the command to add multiple images.
c3d image*.nii -accum -add -endaccum -o sum.nii
1599 def run( 1600 self, 1601 execution: Execution, 1602 ) -> list[str]: 1603 """ 1604 Build command line arguments. This method is called by the main command. 1605 1606 Args: 1607 execution: The execution object. 1608 Returns: 1609 Command line arguments 1610 """ 1611 cargs = [] 1612 cargs.extend([ 1613 "-endaccum", 1614 self.endaccum 1615 ]) 1616 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1619@dataclasses.dataclass 1620class C3dEndfor: 1621 """ 1622 -foreach, -endfor: Loop commands over all images on the stack 1623 1624 Syntax: `-foreach commands-list -endfor` 1625 1626 This command forces the commands between **-foreach** and **-endfor** to be 1627 applied to every image on the stack. The main use of this command is to 1628 automate processing of multiple datasets. For example, 1629 1630 c3d epi*.nii -foreach -smooth 3mm -endfor -oo epism%03d.nii. 1631 """ 1632 endfor: str 1633 """-foreach, -endfor: Loop commands over all images on the stack 1634 1635 Syntax: `-foreach commands-list -endfor` 1636 1637 This command forces the commands between **-foreach** and **-endfor** to be 1638 applied to every image on the stack. The main use of this command is to 1639 automate processing of multiple datasets. For example, 1640 1641 c3d epi*.nii -foreach -smooth 3mm -endfor -oo epism%03d.nii""" 1642 1643 def run( 1644 self, 1645 execution: Execution, 1646 ) -> list[str]: 1647 """ 1648 Build command line arguments. This method is called by the main command. 1649 1650 Args: 1651 execution: The execution object. 1652 Returns: 1653 Command line arguments 1654 """ 1655 cargs = [] 1656 cargs.extend([ 1657 "-endfor", 1658 self.endfor 1659 ]) 1660 return cargs
-foreach, -endfor: Loop commands over all images on the stack
Syntax: -foreach commands-list -endfor
This command forces the commands between -foreach and -endfor to be applied to every image on the stack. The main use of this command is to automate processing of multiple datasets. For example,
c3d epi*.nii -foreach -smooth 3mm -endfor -oo epism%03d.nii.
-foreach, -endfor: Loop commands over all images on the stack
Syntax: -foreach commands-list -endfor
This command forces the commands between -foreach and -endfor to be applied to every image on the stack. The main use of this command is to automate processing of multiple datasets. For example,
c3d epi*.nii -foreach -smooth 3mm -endfor -oo epism%03d.nii
1643 def run( 1644 self, 1645 execution: Execution, 1646 ) -> list[str]: 1647 """ 1648 Build command line arguments. This method is called by the main command. 1649 1650 Args: 1651 execution: The execution object. 1652 Returns: 1653 Command line arguments 1654 """ 1655 cargs = [] 1656 cargs.extend([ 1657 "-endfor", 1658 self.endfor 1659 ]) 1660 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1707@dataclasses.dataclass 1708class C3dErf: 1709 """ 1710 -erf: Standard error function 1711 1712 Syntax: `-erf mu sigma` 1713 1714 Computes the standard error function. This is useful for applying soft 1715 thresholds. The function computes y = erf((x - mu)/sigma). 1716 1717 c3d input.img -erf 5 2 -o erf.img. 1718 """ 1719 erf: str 1720 """-erf: Standard error function 1721 1722 Syntax: `-erf mu sigma` 1723 1724 Computes the standard error function. This is useful for applying soft 1725 thresholds. The function computes y = erf((x - mu)/sigma). 1726 1727 c3d input.img -erf 5 2 -o erf.img""" 1728 1729 def run( 1730 self, 1731 execution: Execution, 1732 ) -> list[str]: 1733 """ 1734 Build command line arguments. This method is called by the main command. 1735 1736 Args: 1737 execution: The execution object. 1738 Returns: 1739 Command line arguments 1740 """ 1741 cargs = [] 1742 cargs.extend([ 1743 "-erf", 1744 self.erf 1745 ]) 1746 return cargs
-erf: Standard error function
Syntax: -erf mu sigma
Computes the standard error function. This is useful for applying soft thresholds. The function computes y = erf((x - mu)/sigma).
c3d input.img -erf 5 2 -o erf.img.
-erf: Standard error function
Syntax: -erf mu sigma
Computes the standard error function. This is useful for applying soft thresholds. The function computes y = erf((x - mu)/sigma).
c3d input.img -erf 5 2 -o erf.img
1729 def run( 1730 self, 1731 execution: Execution, 1732 ) -> list[str]: 1733 """ 1734 Build command line arguments. This method is called by the main command. 1735 1736 Args: 1737 execution: The execution object. 1738 Returns: 1739 Command line arguments 1740 """ 1741 cargs = [] 1742 cargs.extend([ 1743 "-erf", 1744 self.erf 1745 ]) 1746 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1663@dataclasses.dataclass 1664class C3dErode: 1665 """ 1666 -erode: Binary erosion 1667 1668 Syntax: `-erode <label> <radius_vector>` 1669 1670 Applies erosion [mathematical morphology][5] operation to a binary image. 1671 The first parameter is the intensity value of the object that is to be 1672 eroded. The second is the radius of the erosion structuring element in 3D. 1673 1674 c3d binary.img -erode 255 3x3x3vox -o newimage.img. 1675 """ 1676 erode: str 1677 """-erode: Binary erosion 1678 1679 Syntax: `-erode <label> <radius_vector>` 1680 1681 Applies erosion [mathematical morphology][5] operation to a binary image. 1682 The first parameter is the intensity value of the object that is to be 1683 eroded. The second is the radius of the erosion structuring element in 3D. 1684 1685 c3d binary.img -erode 255 3x3x3vox -o newimage.img""" 1686 1687 def run( 1688 self, 1689 execution: Execution, 1690 ) -> list[str]: 1691 """ 1692 Build command line arguments. This method is called by the main command. 1693 1694 Args: 1695 execution: The execution object. 1696 Returns: 1697 Command line arguments 1698 """ 1699 cargs = [] 1700 cargs.extend([ 1701 "-erode", 1702 self.erode 1703 ]) 1704 return cargs
-erode: Binary erosion
Syntax: -erode <label> <radius_vector>
Applies erosion [mathematical morphology][5] operation to a binary image. The first parameter is the intensity value of the object that is to be eroded. The second is the radius of the erosion structuring element in 3D.
c3d binary.img -erode 255 3x3x3vox -o newimage.img.
-erode: Binary erosion
Syntax: -erode <label> <radius_vector>
Applies erosion [mathematical morphology][5] operation to a binary image. The first parameter is the intensity value of the object that is to be eroded. The second is the radius of the erosion structuring element in 3D.
c3d binary.img -erode 255 3x3x3vox -o newimage.img
1687 def run( 1688 self, 1689 execution: Execution, 1690 ) -> list[str]: 1691 """ 1692 Build command line arguments. This method is called by the main command. 1693 1694 Args: 1695 execution: The execution object. 1696 Returns: 1697 Command line arguments 1698 """ 1699 cargs = [] 1700 cargs.extend([ 1701 "-erode", 1702 self.erode 1703 ]) 1704 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1749@dataclasses.dataclass 1750class C3dExp: 1751 """ 1752 -exp: Voxelwise natural exponent 1753 1754 Syntax: `-exp` 1755 1756 Computes exponent of each voxel in the last image on the stack. 1757 1758 c3d input.img -exp -o output.img. 1759 """ 1760 exp: str 1761 """-exp: Voxelwise natural exponent 1762 1763 Syntax: `-exp` 1764 1765 Computes exponent of each voxel in the last image on the stack. 1766 1767 c3d input.img -exp -o output.img""" 1768 1769 def run( 1770 self, 1771 execution: Execution, 1772 ) -> list[str]: 1773 """ 1774 Build command line arguments. This method is called by the main command. 1775 1776 Args: 1777 execution: The execution object. 1778 Returns: 1779 Command line arguments 1780 """ 1781 cargs = [] 1782 cargs.extend([ 1783 "-exp", 1784 self.exp 1785 ]) 1786 return cargs
-exp: Voxelwise natural exponent
Syntax: -exp
Computes exponent of each voxel in the last image on the stack.
c3d input.img -exp -o output.img.
-exp: Voxelwise natural exponent
Syntax: -exp
Computes exponent of each voxel in the last image on the stack.
c3d input.img -exp -o output.img
1769 def run( 1770 self, 1771 execution: Execution, 1772 ) -> list[str]: 1773 """ 1774 Build command line arguments. This method is called by the main command. 1775 1776 Args: 1777 execution: The execution object. 1778 Returns: 1779 Command line arguments 1780 """ 1781 cargs = [] 1782 cargs.extend([ 1783 "-exp", 1784 self.exp 1785 ]) 1786 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1789@dataclasses.dataclass 1790class C3dExportPatches: 1791 """ 1792 -export-patches, -xp: Fixed size patch sampling from masked regions 1793 1794 Syntax: `-export-patches <outfile> <radius_vector> <frequency>` 1795 1796 See also: **-export-patches-aug (-xpa)** command, which provides data 1797 augmentation for deep learning. 1798 1799 This command samples patches from a region of a ND image and stores them 1800 into a data file that can be read easily in other software, for example, 1801 NumPy. This is useful for generating training data for machine learning 1802 projects. Multiple "channels" can be sampled. 1803 1804 c3d chan1.nii chan2.nii chan3.nii mask.nii -xp samples.dat 4x4x4 100 1805 1806 This command will sample the three images chan1, chan2, chan3 at foreground 1807 voxels in the mask. Voxels in the mask foreground region are sampled 1808 randomly, following a uniform distribution. The value of 100 means that 1809 every 100-th voxel, on average, is sampled. The radius 4x4x4 means that 1810 patches of size 9x9x9 will be generated. For each sampled voxel, the sampled 1811 intensity data is represented as a 3x9x9x9 array in this example. 1812 1813 To read these samples in NumPy use the following code 1814 1815 dims = (9,9,9) # Patch dimensions 1816 k = 3 # Number of channels 1817 bps = (4 * k * reduce(mul, dims, 1)) # Bytes per sample 1818 np = os.path.getsize(fname) // bps # Number of samples 1819 arr = numpy.memmap(fname,'float32','r',shape=(np,k) + dims) 1820 1821 It is also possible to visualize the extracted samples in ITK-SNAP by 1822 reading them as a raw image, with dimensions equal to the dimensions of the 1823 patch, and the z-dimension multiplied by the number of samples. 1824 1825 The command can also be used to extract entire structures. For example, if 1826 we have a binary segmentation of a lesion of an approximately known size in 1827 an MRI scan, we can extract a patch of given size centered on this lesion, 1828 as follows: 1829 1830 c3d mri.nii lesion_seg.nii -centroid-mark 1 -xp single_sample.dat 50x50x20 1 1831 1832 In the above example, **-centroid-mark** transforms the lesion segmentation 1833 into a single-voxel mask, from which the sample from the MRI is taken. 1834 """ 1835 export_patches: str 1836 """-export-patches, -xp: Fixed size patch sampling from masked regions 1837 1838 Syntax: `-export-patches <outfile> <radius_vector> <frequency>` 1839 1840 See also: **-export-patches-aug (-xpa)** command, which provides data 1841 augmentation for deep learning. 1842 1843 This command samples patches from a region of a ND image and stores them 1844 into a data file that can be read easily in other software, for example, 1845 NumPy. This is useful for generating training data for machine learning 1846 projects. Multiple "channels" can be sampled. 1847 1848 c3d chan1.nii chan2.nii chan3.nii mask.nii -xp samples.dat 4x4x4 100 1849 1850 This command will sample the three images chan1, chan2, chan3 at foreground 1851 voxels in the mask. Voxels in the mask foreground region are sampled 1852 randomly, following a uniform distribution. The value of 100 means that 1853 every 100-th voxel, on average, is sampled. The radius 4x4x4 means that 1854 patches of size 9x9x9 will be generated. For each sampled voxel, the sampled 1855 intensity data is represented as a 3x9x9x9 array in this example. 1856 1857 To read these samples in NumPy use the following code 1858 1859 dims = (9,9,9) # Patch dimensions 1860 k = 3 # Number of channels 1861 bps = (4 * k * reduce(mul, dims, 1)) # Bytes per sample 1862 np = os.path.getsize(fname) // bps # Number of samples 1863 arr = numpy.memmap(fname,'float32','r',shape=(np,k) + dims) 1864 1865 It is also possible to visualize the extracted samples in ITK-SNAP by 1866 reading them as a raw image, with dimensions equal to the dimensions of the 1867 patch, and the z-dimension multiplied by the number of samples. 1868 1869 The command can also be used to extract entire structures. For example, if 1870 we have a binary segmentation of a lesion of an approximately known size in 1871 an MRI scan, we can extract a patch of given size centered on this lesion, 1872 as follows: 1873 1874 c3d mri.nii lesion_seg.nii -centroid-mark 1 -xp single_sample.dat 50x50x20 1 1875 1876 In the above example, **-centroid-mark** transforms the lesion segmentation 1877 into a single-voxel mask, from which the sample from the MRI is taken.""" 1878 1879 def run( 1880 self, 1881 execution: Execution, 1882 ) -> list[str]: 1883 """ 1884 Build command line arguments. This method is called by the main command. 1885 1886 Args: 1887 execution: The execution object. 1888 Returns: 1889 Command line arguments 1890 """ 1891 cargs = [] 1892 cargs.extend([ 1893 "-export-patches", 1894 self.export_patches 1895 ]) 1896 return cargs
-export-patches, -xp: Fixed size patch sampling from masked regions
Syntax: -export-patches <outfile> <radius_vector> <frequency>
See also: -export-patches-aug (-xpa) command, which provides data augmentation for deep learning.
This command samples patches from a region of a ND image and stores them into a data file that can be read easily in other software, for example, NumPy. This is useful for generating training data for machine learning projects. Multiple "channels" can be sampled.
c3d chan1.nii chan2.nii chan3.nii mask.nii -xp samples.dat 4x4x4 100
This command will sample the three images chan1, chan2, chan3 at foreground voxels in the mask. Voxels in the mask foreground region are sampled randomly, following a uniform distribution. The value of 100 means that every 100-th voxel, on average, is sampled. The radius 4x4x4 means that patches of size 9x9x9 will be generated. For each sampled voxel, the sampled intensity data is represented as a 3x9x9x9 array in this example.
To read these samples in NumPy use the following code
dims = (9,9,9) # Patch dimensions k = 3 # Number of channels bps = (4 * k * reduce(mul, dims, 1)) # Bytes per sample np = os.path.getsize(fname) // bps # Number of samples arr = numpy.memmap(fname,'float32','r',shape=(np,k) + dims)
It is also possible to visualize the extracted samples in ITK-SNAP by reading them as a raw image, with dimensions equal to the dimensions of the patch, and the z-dimension multiplied by the number of samples.
The command can also be used to extract entire structures. For example, if we have a binary segmentation of a lesion of an approximately known size in an MRI scan, we can extract a patch of given size centered on this lesion, as follows:
c3d mri.nii lesion_seg.nii -centroid-mark 1 -xp single_sample.dat 50x50x20 1
In the above example, -centroid-mark transforms the lesion segmentation into a single-voxel mask, from which the sample from the MRI is taken.
-export-patches, -xp: Fixed size patch sampling from masked regions
Syntax: -export-patches <outfile> <radius_vector> <frequency>
See also: -export-patches-aug (-xpa) command, which provides data augmentation for deep learning.
This command samples patches from a region of a ND image and stores them into a data file that can be read easily in other software, for example, NumPy. This is useful for generating training data for machine learning projects. Multiple "channels" can be sampled.
c3d chan1.nii chan2.nii chan3.nii mask.nii -xp samples.dat 4x4x4 100
This command will sample the three images chan1, chan2, chan3 at foreground voxels in the mask. Voxels in the mask foreground region are sampled randomly, following a uniform distribution. The value of 100 means that every 100-th voxel, on average, is sampled. The radius 4x4x4 means that patches of size 9x9x9 will be generated. For each sampled voxel, the sampled intensity data is represented as a 3x9x9x9 array in this example.
To read these samples in NumPy use the following code
dims = (9,9,9) # Patch dimensions k = 3 # Number of channels bps = (4 * k * reduce(mul, dims, 1)) # Bytes per sample np = os.path.getsize(fname) // bps # Number of samples arr = numpy.memmap(fname,'float32','r',shape=(np,k) + dims)
It is also possible to visualize the extracted samples in ITK-SNAP by reading them as a raw image, with dimensions equal to the dimensions of the patch, and the z-dimension multiplied by the number of samples.
The command can also be used to extract entire structures. For example, if we have a binary segmentation of a lesion of an approximately known size in an MRI scan, we can extract a patch of given size centered on this lesion, as follows:
c3d mri.nii lesion_seg.nii -centroid-mark 1 -xp single_sample.dat 50x50x20 1
In the above example, -centroid-mark transforms the lesion segmentation into a single-voxel mask, from which the sample from the MRI is taken.
1879 def run( 1880 self, 1881 execution: Execution, 1882 ) -> list[str]: 1883 """ 1884 Build command line arguments. This method is called by the main command. 1885 1886 Args: 1887 execution: The execution object. 1888 Returns: 1889 Command line arguments 1890 """ 1891 cargs = [] 1892 cargs.extend([ 1893 "-export-patches", 1894 self.export_patches 1895 ]) 1896 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1899@dataclasses.dataclass 1900class C3dExportPatchesAug: 1901 """ 1902 -export-patches-aug, -xpa: data augmentation for deep learning 1903 1904 Syntax `-export-patches-aug <N> <sigma_angle>` 1905 1906 This command must precede the `-export-patches (-xp)` command and instructs 1907 this command to not only sample patches along the image axes but to also 1908 sample **N** randomly rotated patches. Rotation is around a uniformly 1909 distributed axis with a rotation angle distributed normally with teh 1910 standard deviation **sigma_angle**, specified in degrees. This kind of 1911 sampling is useful for data augmentation for machine learning algorithms. 1912 1913 c3d chan1.nii chan2.nii chan3.nii mask.nii -xpa 5 10 -xp samples.dat 4x4x4 1914 100. 1915 """ 1916 export_patches_aug: str 1917 """-export-patches-aug, -xpa: data augmentation for deep learning 1918 1919 Syntax `-export-patches-aug <N> <sigma_angle>` 1920 1921 This command must precede the `-export-patches (-xp)` command and instructs 1922 this command to not only sample patches along the image axes but to also 1923 sample **N** randomly rotated patches. Rotation is around a uniformly 1924 distributed axis with a rotation angle distributed normally with teh 1925 standard deviation **sigma_angle**, specified in degrees. This kind of 1926 sampling is useful for data augmentation for machine learning algorithms. 1927 1928 c3d chan1.nii chan2.nii chan3.nii mask.nii -xpa 5 10 -xp samples.dat 4x4x4 1929 100""" 1930 1931 def run( 1932 self, 1933 execution: Execution, 1934 ) -> list[str]: 1935 """ 1936 Build command line arguments. This method is called by the main command. 1937 1938 Args: 1939 execution: The execution object. 1940 Returns: 1941 Command line arguments 1942 """ 1943 cargs = [] 1944 cargs.extend([ 1945 "-export-patches-aug", 1946 self.export_patches_aug 1947 ]) 1948 return cargs
-export-patches-aug, -xpa: data augmentation for deep learning
Syntax -export-patches-aug <N> <sigma_angle>
This command must precede the -export-patches (-xp) command and instructs
this command to not only sample patches along the image axes but to also
sample N randomly rotated patches. Rotation is around a uniformly
distributed axis with a rotation angle distributed normally with teh
standard deviation sigma_angle, specified in degrees. This kind of
sampling is useful for data augmentation for machine learning algorithms.
c3d chan1.nii chan2.nii chan3.nii mask.nii -xpa 5 10 -xp samples.dat 4x4x4 100.
-export-patches-aug, -xpa: data augmentation for deep learning
Syntax -export-patches-aug <N> <sigma_angle>
This command must precede the -export-patches (-xp) command and instructs
this command to not only sample patches along the image axes but to also
sample N randomly rotated patches. Rotation is around a uniformly
distributed axis with a rotation angle distributed normally with teh
standard deviation sigma_angle, specified in degrees. This kind of
sampling is useful for data augmentation for machine learning algorithms.
c3d chan1.nii chan2.nii chan3.nii mask.nii -xpa 5 10 -xp samples.dat 4x4x4 100
1931 def run( 1932 self, 1933 execution: Execution, 1934 ) -> list[str]: 1935 """ 1936 Build command line arguments. This method is called by the main command. 1937 1938 Args: 1939 execution: The execution object. 1940 Returns: 1941 Command line arguments 1942 """ 1943 cargs = [] 1944 cargs.extend([ 1945 "-export-patches-aug", 1946 self.export_patches_aug 1947 ]) 1948 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1951@dataclasses.dataclass 1952class C3dExtrudeSeg: 1953 """ 1954 No description found. 1955 """ 1956 extrude_seg: str 1957 """No description found.""" 1958 1959 def run( 1960 self, 1961 execution: Execution, 1962 ) -> list[str]: 1963 """ 1964 Build command line arguments. This method is called by the main command. 1965 1966 Args: 1967 execution: The execution object. 1968 Returns: 1969 Command line arguments 1970 """ 1971 cargs = [] 1972 cargs.extend([ 1973 "-extrude-seg", 1974 self.extrude_seg 1975 ]) 1976 return cargs
No description found.
1959 def run( 1960 self, 1961 execution: Execution, 1962 ) -> list[str]: 1963 """ 1964 Build command line arguments. This method is called by the main command. 1965 1966 Args: 1967 execution: The execution object. 1968 Returns: 1969 Command line arguments 1970 """ 1971 cargs = [] 1972 cargs.extend([ 1973 "-extrude-seg", 1974 self.extrude_seg 1975 ]) 1976 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2007@dataclasses.dataclass 2008class C3dFft: 2009 """ 2010 -fft: Fast Fourier transform 2011 2012 Syntax `-fft` 2013 2014 Computes the Fourier transform of a real-valued image at the end of the 2015 stack. The image is replaced by the real and imaginary components of the 2016 FFT. This command is only available if **convert3d** is compiled with the 2017 FFTW library support. 2018 2019 c3d image.nii -fft -oo real.nii imag.nii. 2020 """ 2021 fft: str 2022 """-fft: Fast Fourier transform 2023 2024 Syntax `-fft` 2025 2026 Computes the Fourier transform of a real-valued image at the end of the 2027 stack. The image is replaced by the real and imaginary components of the 2028 FFT. This command is only available if **convert3d** is compiled with the 2029 FFTW library support. 2030 2031 c3d image.nii -fft -oo real.nii imag.nii""" 2032 2033 def run( 2034 self, 2035 execution: Execution, 2036 ) -> list[str]: 2037 """ 2038 Build command line arguments. This method is called by the main command. 2039 2040 Args: 2041 execution: The execution object. 2042 Returns: 2043 Command line arguments 2044 """ 2045 cargs = [] 2046 cargs.extend([ 2047 "-fft", 2048 self.fft 2049 ]) 2050 return cargs
-fft: Fast Fourier transform
Syntax -fft
Computes the Fourier transform of a real-valued image at the end of the stack. The image is replaced by the real and imaginary components of the FFT. This command is only available if convert3d is compiled with the FFTW library support.
c3d image.nii -fft -oo real.nii imag.nii.
-fft: Fast Fourier transform
Syntax -fft
Computes the Fourier transform of a real-valued image at the end of the stack. The image is replaced by the real and imaginary components of the FFT. This command is only available if convert3d is compiled with the FFTW library support.
c3d image.nii -fft -oo real.nii imag.nii
2033 def run( 2034 self, 2035 execution: Execution, 2036 ) -> list[str]: 2037 """ 2038 Build command line arguments. This method is called by the main command. 2039 2040 Args: 2041 execution: The execution object. 2042 Returns: 2043 Command line arguments 2044 """ 2045 cargs = [] 2046 cargs.extend([ 2047 "-fft", 2048 self.fft 2049 ]) 2050 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1979@dataclasses.dataclass 1980class C3dFillBackgroundWithNoise: 1981 """ 1982 No description found. 1983 """ 1984 fill_background_with_noise: str 1985 """No description found.""" 1986 1987 def run( 1988 self, 1989 execution: Execution, 1990 ) -> list[str]: 1991 """ 1992 Build command line arguments. This method is called by the main command. 1993 1994 Args: 1995 execution: The execution object. 1996 Returns: 1997 Command line arguments 1998 """ 1999 cargs = [] 2000 cargs.extend([ 2001 "-fill-background-with-noise", 2002 self.fill_background_with_noise 2003 ]) 2004 return cargs
No description found.
1987 def run( 1988 self, 1989 execution: Execution, 1990 ) -> list[str]: 1991 """ 1992 Build command line arguments. This method is called by the main command. 1993 1994 Args: 1995 execution: The execution object. 1996 Returns: 1997 Command line arguments 1998 """ 1999 cargs = [] 2000 cargs.extend([ 2001 "-fill-background-with-noise", 2002 self.fill_background_with_noise 2003 ]) 2004 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2053@dataclasses.dataclass 2054class C3dFlip: 2055 """ 2056 -flip: Flip image around an axis 2057 2058 Syntax: `-flip axes` 2059 2060 Flips the image around specified axes. The parameter 'axes' may be any 2061 combination of characters 'x', 'y', and 'z'; the order does not matter. 2062 2063 c3d input.img -flip xy -o output.img. 2064 """ 2065 flip: str 2066 """-flip: Flip image around an axis 2067 2068 Syntax: `-flip axes` 2069 2070 Flips the image around specified axes. The parameter 'axes' may be any 2071 combination of characters 'x', 'y', and 'z'; the order does not matter. 2072 2073 c3d input.img -flip xy -o output.img""" 2074 2075 def run( 2076 self, 2077 execution: Execution, 2078 ) -> list[str]: 2079 """ 2080 Build command line arguments. This method is called by the main command. 2081 2082 Args: 2083 execution: The execution object. 2084 Returns: 2085 Command line arguments 2086 """ 2087 cargs = [] 2088 cargs.extend([ 2089 "-flip", 2090 self.flip 2091 ]) 2092 return cargs
-flip: Flip image around an axis
Syntax: -flip axes
Flips the image around specified axes. The parameter 'axes' may be any combination of characters 'x', 'y', and 'z'; the order does not matter.
c3d input.img -flip xy -o output.img.
-flip: Flip image around an axis
Syntax: -flip axes
Flips the image around specified axes. The parameter 'axes' may be any combination of characters 'x', 'y', and 'z'; the order does not matter.
c3d input.img -flip xy -o output.img
2075 def run( 2076 self, 2077 execution: Execution, 2078 ) -> list[str]: 2079 """ 2080 Build command line arguments. This method is called by the main command. 2081 2082 Args: 2083 execution: The execution object. 2084 Returns: 2085 Command line arguments 2086 """ 2087 cargs = [] 2088 cargs.extend([ 2089 "-flip", 2090 self.flip 2091 ]) 2092 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2095@dataclasses.dataclass 2096class C3dFloor: 2097 """ 2098 -floor: Round down image intensities 2099 2100 Syntax: `-floor ` 2101 2102 Each image intensity is replaced by the largest integer smaller or equal to 2103 it. 2104 2105 c3d input.img -floor -o output.img 2106 2107 To round each intensity to the closest integer, use 2108 2109 c3d input.img -shift 0.5 -floor. 2110 """ 2111 floor: str 2112 """-floor: Round down image intensities 2113 2114 Syntax: `-floor ` 2115 2116 Each image intensity is replaced by the largest integer smaller or equal to 2117 it. 2118 2119 c3d input.img -floor -o output.img 2120 2121 To round each intensity to the closest integer, use 2122 2123 c3d input.img -shift 0.5 -floor""" 2124 2125 def run( 2126 self, 2127 execution: Execution, 2128 ) -> list[str]: 2129 """ 2130 Build command line arguments. This method is called by the main command. 2131 2132 Args: 2133 execution: The execution object. 2134 Returns: 2135 Command line arguments 2136 """ 2137 cargs = [] 2138 cargs.extend([ 2139 "-floor", 2140 self.floor 2141 ]) 2142 return cargs
-floor: Round down image intensities
Syntax: -floor
Each image intensity is replaced by the largest integer smaller or equal to it.
c3d input.img -floor -o output.img
To round each intensity to the closest integer, use
c3d input.img -shift 0.5 -floor.
-floor: Round down image intensities
Syntax: -floor
Each image intensity is replaced by the largest integer smaller or equal to it.
c3d input.img -floor -o output.img
To round each intensity to the closest integer, use
c3d input.img -shift 0.5 -floor
2125 def run( 2126 self, 2127 execution: Execution, 2128 ) -> list[str]: 2129 """ 2130 Build command line arguments. This method is called by the main command. 2131 2132 Args: 2133 execution: The execution object. 2134 Returns: 2135 Command line arguments 2136 """ 2137 cargs = [] 2138 cargs.extend([ 2139 "-floor", 2140 self.floor 2141 ]) 2142 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2145@dataclasses.dataclass 2146class C3dForeach: 2147 """ 2148 -foreach, -endfor: Loop commands over all images on the stack 2149 2150 Syntax: `-foreach commands-list -endfor` 2151 2152 This command forces the commands between **-foreach** and **-endfor** to be 2153 applied to every image on the stack. The main use of this command is to 2154 automate processing of multiple datasets. For example, 2155 2156 c3d epi*.nii -foreach -smooth 3mm -endfor -oo epism%03d.nii. 2157 """ 2158 foreach: str 2159 """-foreach, -endfor: Loop commands over all images on the stack 2160 2161 Syntax: `-foreach commands-list -endfor` 2162 2163 This command forces the commands between **-foreach** and **-endfor** to be 2164 applied to every image on the stack. The main use of this command is to 2165 automate processing of multiple datasets. For example, 2166 2167 c3d epi*.nii -foreach -smooth 3mm -endfor -oo epism%03d.nii""" 2168 2169 def run( 2170 self, 2171 execution: Execution, 2172 ) -> list[str]: 2173 """ 2174 Build command line arguments. This method is called by the main command. 2175 2176 Args: 2177 execution: The execution object. 2178 Returns: 2179 Command line arguments 2180 """ 2181 cargs = [] 2182 cargs.extend([ 2183 "-foreach", 2184 self.foreach 2185 ]) 2186 return cargs
-foreach, -endfor: Loop commands over all images on the stack
Syntax: -foreach commands-list -endfor
This command forces the commands between -foreach and -endfor to be applied to every image on the stack. The main use of this command is to automate processing of multiple datasets. For example,
c3d epi*.nii -foreach -smooth 3mm -endfor -oo epism%03d.nii.
-foreach, -endfor: Loop commands over all images on the stack
Syntax: -foreach commands-list -endfor
This command forces the commands between -foreach and -endfor to be applied to every image on the stack. The main use of this command is to automate processing of multiple datasets. For example,
c3d epi*.nii -foreach -smooth 3mm -endfor -oo epism%03d.nii
2169 def run( 2170 self, 2171 execution: Execution, 2172 ) -> list[str]: 2173 """ 2174 Build command line arguments. This method is called by the main command. 2175 2176 Args: 2177 execution: The execution object. 2178 Returns: 2179 Command line arguments 2180 """ 2181 cargs = [] 2182 cargs.extend([ 2183 "-foreach", 2184 self.foreach 2185 ]) 2186 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2189@dataclasses.dataclass 2190class C3dForeachComp: 2191 """ 2192 -foreach-comp, -endfor: Loop commands over components of a multi-component 2193 image 2194 2195 Syntax `-foreach-comp <N> commands-list -endfor` 2196 2197 This command runs the list of commands separately for each component of a 2198 set of multi-component images loaded with -mcs. This makes it possible to 2199 perform component-wise operations on multi-component images. For example, it 2200 can be used to average several multi-component images. If the image stack 2201 contains images *x1* *y1* *z1* *x2* *y2* *z2*, then the operations will be 2202 run on *[x1,x2]*, *[y1,y2]*, *[z1,z2]*. For example, if multi_1.nii to 2203 multi_10.nii are three-component images, then the mean three-component image 2204 is given by 2205 2206 c2d -mcs multi_*.nii -foreach-comp -mean -endfor -omc multi_mean.nii. 2207 """ 2208 foreach_comp: str 2209 """-foreach-comp, -endfor: Loop commands over components of a 2210 multi-component image 2211 2212 Syntax `-foreach-comp <N> commands-list -endfor` 2213 2214 This command runs the list of commands separately for each component of a 2215 set of multi-component images loaded with -mcs. This makes it possible to 2216 perform component-wise operations on multi-component images. For example, it 2217 can be used to average several multi-component images. If the image stack 2218 contains images *x1* *y1* *z1* *x2* *y2* *z2*, then the operations will be 2219 run on *[x1,x2]*, *[y1,y2]*, *[z1,z2]*. For example, if multi_1.nii to 2220 multi_10.nii are three-component images, then the mean three-component image 2221 is given by 2222 2223 c2d -mcs multi_*.nii -foreach-comp -mean -endfor -omc multi_mean.nii""" 2224 2225 def run( 2226 self, 2227 execution: Execution, 2228 ) -> list[str]: 2229 """ 2230 Build command line arguments. This method is called by the main command. 2231 2232 Args: 2233 execution: The execution object. 2234 Returns: 2235 Command line arguments 2236 """ 2237 cargs = [] 2238 cargs.extend([ 2239 "-foreach-comp", 2240 self.foreach_comp 2241 ]) 2242 return cargs
-foreach-comp, -endfor: Loop commands over components of a multi-component image
Syntax -foreach-comp <N> commands-list -endfor
This command runs the list of commands separately for each component of a set of multi-component images loaded with -mcs. This makes it possible to perform component-wise operations on multi-component images. For example, it can be used to average several multi-component images. If the image stack contains images x1 y1 z1 x2 y2 z2, then the operations will be run on [x1,x2], [y1,y2], [z1,z2]. For example, if multi_1.nii to multi_10.nii are three-component images, then the mean three-component image is given by
c2d -mcs multi_*.nii -foreach-comp -mean -endfor -omc multi_mean.nii.
-foreach-comp, -endfor: Loop commands over components of a multi-component image
Syntax -foreach-comp <N> commands-list -endfor
This command runs the list of commands separately for each component of a set of multi-component images loaded with -mcs. This makes it possible to perform component-wise operations on multi-component images. For example, it can be used to average several multi-component images. If the image stack contains images x1 y1 z1 x2 y2 z2, then the operations will be run on [x1,x2], [y1,y2], [z1,z2]. For example, if multi_1.nii to multi_10.nii are three-component images, then the mean three-component image is given by
c2d -mcs multi_*.nii -foreach-comp -mean -endfor -omc multi_mean.nii
2225 def run( 2226 self, 2227 execution: Execution, 2228 ) -> list[str]: 2229 """ 2230 Build command line arguments. This method is called by the main command. 2231 2232 Args: 2233 execution: The execution object. 2234 Returns: 2235 Command line arguments 2236 """ 2237 cargs = [] 2238 cargs.extend([ 2239 "-foreach-comp", 2240 self.foreach_comp 2241 ]) 2242 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2245@dataclasses.dataclass 2246class C3dGlm: 2247 """ 2248 -glm: General linear model 2249 2250 Syntax: `-glm design_matrix_file contrast_vector_file` 2251 2252 Applies voxel-wise general linear model to a set of images. More precisely, 2253 the general linear model solves the following system: $Y = X \beta + 2254 \epsilon$, where Y are the observations (a list of n images, where each 2255 voxel is treated as an independent observation); X is the $n x k$ design 2256 matrix, where $k$ is the number of factors; $\beta$ is a set of $k$ unknown 2257 images (factors) and $\epsilon$ is the error term. The command will compute 2258 the $\beta$ images and return a weighted sum of them, where the weights are 2259 specified in the contrast vector. The design matrix and the contrast vector 2260 are passed in as files. The file format is just a space-separated list of 2261 numbers. For a good explanation of the general linear model, see [S. Kiebel 2262 and A. Holmes, General Linear Model, in Ashburner, Friston, Holmes eds., 2263 *Human Brain Function, 2nd Edition*][6]. The example below computes the 2264 regression coefficient between a set of longitudinal images and subject's 2265 age: 2266 2267 echo "1 67.00" > design_mat.txt 2268 echo "1 75.00" >> design_mat.txt 2269 echo "1 80.00" >> design_mat.txt 2270 echo "1 83.00" >> design_mat.txt 2271 echo "0 1" >> contrast_vec.txt 2272 c3d time1.img time2.img time3.img time4.img -glm design_mat.txt 2273 contrast_vec.txt -o regress.img. 2274 """ 2275 glm: str 2276 """-glm: General linear model 2277 2278 Syntax: `-glm design_matrix_file contrast_vector_file` 2279 2280 Applies voxel-wise general linear model to a set of images. More precisely, 2281 the general linear model solves the following system: $Y = X \beta + 2282 \epsilon$, where Y are the observations (a list of n images, where each 2283 voxel is treated as an independent observation); X is the $n x k$ design 2284 matrix, where $k$ is the number of factors; $\beta$ is a set of $k$ unknown 2285 images (factors) and $\epsilon$ is the error term. The command will compute 2286 the $\beta$ images and return a weighted sum of them, where the weights are 2287 specified in the contrast vector. The design matrix and the contrast vector 2288 are passed in as files. The file format is just a space-separated list of 2289 numbers. For a good explanation of the general linear model, see [S. Kiebel 2290 and A. Holmes, General Linear Model, in Ashburner, Friston, Holmes eds., 2291 *Human Brain Function, 2nd Edition*][6]. The example below computes the 2292 regression coefficient between a set of longitudinal images and subject's 2293 age: 2294 2295 echo "1 67.00" > design_mat.txt 2296 echo "1 75.00" >> design_mat.txt 2297 echo "1 80.00" >> design_mat.txt 2298 echo "1 83.00" >> design_mat.txt 2299 echo "0 1" >> contrast_vec.txt 2300 c3d time1.img time2.img time3.img time4.img -glm design_mat.txt 2301 contrast_vec.txt -o regress.img""" 2302 2303 def run( 2304 self, 2305 execution: Execution, 2306 ) -> list[str]: 2307 """ 2308 Build command line arguments. This method is called by the main command. 2309 2310 Args: 2311 execution: The execution object. 2312 Returns: 2313 Command line arguments 2314 """ 2315 cargs = [] 2316 cargs.extend([ 2317 "-glm", 2318 self.glm 2319 ]) 2320 return cargs
-glm: General linear model
Syntax: -glm design_matrix_file contrast_vector_file
Applies voxel-wise general linear model to a set of images. More precisely, the general linear model solves the following system: $Y = X eta + \epsilon$, where Y are the observations (a list of n images, where each voxel is treated as an independent observation); X is the $n x k$ design matrix, where $k$ is the number of factors; $eta$ is a set of $k$ unknown images (factors) and $\epsilon$ is the error term. The command will compute the $eta$ images and return a weighted sum of them, where the weights are specified in the contrast vector. The design matrix and the contrast vector are passed in as files. The file format is just a space-separated list of numbers. For a good explanation of the general linear model, see [S. Kiebel and A. Holmes, General Linear Model, in Ashburner, Friston, Holmes eds., Human Brain Function, 2nd Edition][6]. The example below computes the regression coefficient between a set of longitudinal images and subject's age:
echo "1 67.00" > design_mat.txt echo "1 75.00" >> design_mat.txt echo "1 80.00" >> design_mat.txt echo "1 83.00" >> design_mat.txt echo "0 1" >> contrast_vec.txt c3d time1.img time2.img time3.img time4.img -glm design_mat.txt contrast_vec.txt -o regress.img.
-glm: General linear model
Syntax: -glm design_matrix_file contrast_vector_file
Applies voxel-wise general linear model to a set of images. More precisely, the general linear model solves the following system: $Y = X eta + \epsilon$, where Y are the observations (a list of n images, where each voxel is treated as an independent observation); X is the $n x k$ design matrix, where $k$ is the number of factors; $eta$ is a set of $k$ unknown images (factors) and $\epsilon$ is the error term. The command will compute the $eta$ images and return a weighted sum of them, where the weights are specified in the contrast vector. The design matrix and the contrast vector are passed in as files. The file format is just a space-separated list of numbers. For a good explanation of the general linear model, see [S. Kiebel and A. Holmes, General Linear Model, in Ashburner, Friston, Holmes eds., Human Brain Function, 2nd Edition][6]. The example below computes the regression coefficient between a set of longitudinal images and subject's age:
echo "1 67.00" > design_mat.txt echo "1 75.00" >> design_mat.txt echo "1 80.00" >> design_mat.txt echo "1 83.00" >> design_mat.txt echo "0 1" >> contrast_vec.txt c3d time1.img time2.img time3.img time4.img -glm design_mat.txt contrast_vec.txt -o regress.img
2303 def run( 2304 self, 2305 execution: Execution, 2306 ) -> list[str]: 2307 """ 2308 Build command line arguments. This method is called by the main command. 2309 2310 Args: 2311 execution: The execution object. 2312 Returns: 2313 Command line arguments 2314 """ 2315 cargs = [] 2316 cargs.extend([ 2317 "-glm", 2318 self.glm 2319 ]) 2320 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2323@dataclasses.dataclass 2324class C3dGradient: 2325 """ 2326 -grad, -gradient: Image gradient 2327 2328 Syntax `-grad` 2329 2330 Computes the gradient of the image. Each component of the gradient is placed 2331 on the stack in order (x,y,z). The gradient is computed in physical RAS 2332 coordinates, taking into account image spacing and orientation. In other 2333 words, the gradient is the vector in physical space orthogonal to the 2334 isocontours of the image. No smoothing is performed, so it is a good idea to 2335 smooth the image first before computing the gradient. 2336 2337 c3d myimage.nii -smooth 1.2vox -grad -oo grad_comp_%02d.nii. 2338 """ 2339 gradient: str 2340 """-grad, -gradient: Image gradient 2341 2342 Syntax `-grad` 2343 2344 Computes the gradient of the image. Each component of the gradient is placed 2345 on the stack in order (x,y,z). The gradient is computed in physical RAS 2346 coordinates, taking into account image spacing and orientation. In other 2347 words, the gradient is the vector in physical space orthogonal to the 2348 isocontours of the image. No smoothing is performed, so it is a good idea to 2349 smooth the image first before computing the gradient. 2350 2351 c3d myimage.nii -smooth 1.2vox -grad -oo grad_comp_%02d.nii""" 2352 2353 def run( 2354 self, 2355 execution: Execution, 2356 ) -> list[str]: 2357 """ 2358 Build command line arguments. This method is called by the main command. 2359 2360 Args: 2361 execution: The execution object. 2362 Returns: 2363 Command line arguments 2364 """ 2365 cargs = [] 2366 cargs.extend([ 2367 "-grad", 2368 self.gradient 2369 ]) 2370 return cargs
-grad, -gradient: Image gradient
Syntax -grad
Computes the gradient of the image. Each component of the gradient is placed on the stack in order (x,y,z). The gradient is computed in physical RAS coordinates, taking into account image spacing and orientation. In other words, the gradient is the vector in physical space orthogonal to the isocontours of the image. No smoothing is performed, so it is a good idea to smooth the image first before computing the gradient.
c3d myimage.nii -smooth 1.2vox -grad -oo grad_comp_%02d.nii.
-grad, -gradient: Image gradient
Syntax -grad
Computes the gradient of the image. Each component of the gradient is placed on the stack in order (x,y,z). The gradient is computed in physical RAS coordinates, taking into account image spacing and orientation. In other words, the gradient is the vector in physical space orthogonal to the isocontours of the image. No smoothing is performed, so it is a good idea to smooth the image first before computing the gradient.
c3d myimage.nii -smooth 1.2vox -grad -oo grad_comp_%02d.nii
2353 def run( 2354 self, 2355 execution: Execution, 2356 ) -> list[str]: 2357 """ 2358 Build command line arguments. This method is called by the main command. 2359 2360 Args: 2361 execution: The execution object. 2362 Returns: 2363 Command line arguments 2364 """ 2365 cargs = [] 2366 cargs.extend([ 2367 "-grad", 2368 self.gradient 2369 ]) 2370 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2373@dataclasses.dataclass 2374class C3dHelp: 2375 """ 2376 -hesseig, -hessian-eigenvalues: Compute eigenvalues of the Hessian matrix 2377 2378 Syntax `-hesseig <scale>` 2379 2380 Computes the Hessian matrix at every pixel of an image and the eigenvalues 2381 of the Hessian. Images of the eigenvalues (sorted by value) are placed on 2382 the stack. These images are useful as texture features. See also the 2383 '''-steig''' command. The scale determines the amount of Gaussian smoothing 2384 applied for computing the partial derivatives in the Hessian, and is in 2385 physical (mm) units. 2386 2387 c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz. 2388 """ 2389 v__help: str 2390 """-hesseig, -hessian-eigenvalues: Compute eigenvalues of the Hessian matrix 2391 2392 Syntax `-hesseig <scale>` 2393 2394 Computes the Hessian matrix at every pixel of an image and the eigenvalues 2395 of the Hessian. Images of the eigenvalues (sorted by value) are placed on 2396 the stack. These images are useful as texture features. See also the 2397 '''-steig''' command. The scale determines the amount of Gaussian smoothing 2398 applied for computing the partial derivatives in the Hessian, and is in 2399 physical (mm) units. 2400 2401 c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz""" 2402 2403 def run( 2404 self, 2405 execution: Execution, 2406 ) -> list[str]: 2407 """ 2408 Build command line arguments. This method is called by the main command. 2409 2410 Args: 2411 execution: The execution object. 2412 Returns: 2413 Command line arguments 2414 """ 2415 cargs = [] 2416 cargs.extend([ 2417 "-h", 2418 self.v__help 2419 ]) 2420 return cargs
-hesseig, -hessian-eigenvalues: Compute eigenvalues of the Hessian matrix
Syntax -hesseig <scale>
Computes the Hessian matrix at every pixel of an image and the eigenvalues of the Hessian. Images of the eigenvalues (sorted by value) are placed on the stack. These images are useful as texture features. See also the '''-steig''' command. The scale determines the amount of Gaussian smoothing applied for computing the partial derivatives in the Hessian, and is in physical (mm) units.
c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz.
-hesseig, -hessian-eigenvalues: Compute eigenvalues of the Hessian matrix
Syntax -hesseig <scale>
Computes the Hessian matrix at every pixel of an image and the eigenvalues of the Hessian. Images of the eigenvalues (sorted by value) are placed on the stack. These images are useful as texture features. See also the '''-steig''' command. The scale determines the amount of Gaussian smoothing applied for computing the partial derivatives in the Hessian, and is in physical (mm) units.
c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz
2403 def run( 2404 self, 2405 execution: Execution, 2406 ) -> list[str]: 2407 """ 2408 Build command line arguments. This method is called by the main command. 2409 2410 Args: 2411 execution: The execution object. 2412 Returns: 2413 Command line arguments 2414 """ 2415 cargs = [] 2416 cargs.extend([ 2417 "-h", 2418 self.v__help 2419 ]) 2420 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2479@dataclasses.dataclass 2480class C3dHessianEigenvalues: 2481 """ 2482 -hesseig, -hessian-eigenvalues: Compute eigenvalues of the Hessian matrix 2483 2484 Syntax `-hesseig <scale>` 2485 2486 Computes the Hessian matrix at every pixel of an image and the eigenvalues 2487 of the Hessian. Images of the eigenvalues (sorted by value) are placed on 2488 the stack. These images are useful as texture features. See also the 2489 '''-steig''' command. The scale determines the amount of Gaussian smoothing 2490 applied for computing the partial derivatives in the Hessian, and is in 2491 physical (mm) units. 2492 2493 c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz. 2494 """ 2495 hessian_eigenvalues: str 2496 """-hesseig, -hessian-eigenvalues: Compute eigenvalues of the Hessian matrix 2497 2498 Syntax `-hesseig <scale>` 2499 2500 Computes the Hessian matrix at every pixel of an image and the eigenvalues 2501 of the Hessian. Images of the eigenvalues (sorted by value) are placed on 2502 the stack. These images are useful as texture features. See also the 2503 '''-steig''' command. The scale determines the amount of Gaussian smoothing 2504 applied for computing the partial derivatives in the Hessian, and is in 2505 physical (mm) units. 2506 2507 c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz""" 2508 2509 def run( 2510 self, 2511 execution: Execution, 2512 ) -> list[str]: 2513 """ 2514 Build command line arguments. This method is called by the main command. 2515 2516 Args: 2517 execution: The execution object. 2518 Returns: 2519 Command line arguments 2520 """ 2521 cargs = [] 2522 cargs.extend([ 2523 "-hesseig", 2524 self.hessian_eigenvalues 2525 ]) 2526 return cargs
-hesseig, -hessian-eigenvalues: Compute eigenvalues of the Hessian matrix
Syntax -hesseig <scale>
Computes the Hessian matrix at every pixel of an image and the eigenvalues of the Hessian. Images of the eigenvalues (sorted by value) are placed on the stack. These images are useful as texture features. See also the '''-steig''' command. The scale determines the amount of Gaussian smoothing applied for computing the partial derivatives in the Hessian, and is in physical (mm) units.
c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz.
-hesseig, -hessian-eigenvalues: Compute eigenvalues of the Hessian matrix
Syntax -hesseig <scale>
Computes the Hessian matrix at every pixel of an image and the eigenvalues of the Hessian. Images of the eigenvalues (sorted by value) are placed on the stack. These images are useful as texture features. See also the '''-steig''' command. The scale determines the amount of Gaussian smoothing applied for computing the partial derivatives in the Hessian, and is in physical (mm) units.
c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz
2509 def run( 2510 self, 2511 execution: Execution, 2512 ) -> list[str]: 2513 """ 2514 Build command line arguments. This method is called by the main command. 2515 2516 Args: 2517 execution: The execution object. 2518 Returns: 2519 Command line arguments 2520 """ 2521 cargs = [] 2522 cargs.extend([ 2523 "-hesseig", 2524 self.hessian_eigenvalues 2525 ]) 2526 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2529@dataclasses.dataclass 2530class C3dHessianObjectness: 2531 """ 2532 -hessobj, -hessian-objectness: Hessian objectness filter 2533 2534 Syntax: `-hessobj <dimension> <min_scale> <max_scale>` 2535 2536 Also known as the Frangi vesselness filter, this filter can be used to 2537 highlight tube-like, sheet-like and blob-like objects in the image. For 2538 details, see documentation to the [corresponging ITK class][HTOMIF]. 2539 2540 Parameter `dimension` is an integer that determines the kind of features 2541 that are highlighed. Use 0 for blobs, 1 for tubes, 2 for pancakes, etc. The 2542 min and max scale parameters are floating point values, giving the scale of 2543 the features highlighted, in physical units. Typically, just one scale is 2544 used. 2545 2546 # Detect vessel-like structures at scale 0.5mm 2547 c3d image.nii.gz -hessobj 1 0.5 0.5 2548 2549 [HTOMIF] 2550 http://www.itk.org/Doxygen/html/classitk_1_1HessianToObjectnessMeasureImageFilter.html. 2551 """ 2552 hessian_objectness: str 2553 """-hessobj, -hessian-objectness: Hessian objectness filter 2554 2555 Syntax: `-hessobj <dimension> <min_scale> <max_scale>` 2556 2557 Also known as the Frangi vesselness filter, this filter can be used to 2558 highlight tube-like, sheet-like and blob-like objects in the image. For 2559 details, see documentation to the [corresponging ITK class][HTOMIF]. 2560 2561 Parameter `dimension` is an integer that determines the kind of features 2562 that are highlighed. Use 0 for blobs, 1 for tubes, 2 for pancakes, etc. The 2563 min and max scale parameters are floating point values, giving the scale of 2564 the features highlighted, in physical units. Typically, just one scale is 2565 used. 2566 2567 # Detect vessel-like structures at scale 0.5mm 2568 c3d image.nii.gz -hessobj 1 0.5 0.5 2569 2570 [HTOMIF] 2571 http://www.itk.org/Doxygen/html/classitk_1_1HessianToObjectnessMeasureImageFilter.html""" 2572 2573 def run( 2574 self, 2575 execution: Execution, 2576 ) -> list[str]: 2577 """ 2578 Build command line arguments. This method is called by the main command. 2579 2580 Args: 2581 execution: The execution object. 2582 Returns: 2583 Command line arguments 2584 """ 2585 cargs = [] 2586 cargs.extend([ 2587 "-hessobj", 2588 self.hessian_objectness 2589 ]) 2590 return cargs
-hessobj, -hessian-objectness: Hessian objectness filter
Syntax: -hessobj <dimension> <min_scale> <max_scale>
Also known as the Frangi vesselness filter, this filter can be used to highlight tube-like, sheet-like and blob-like objects in the image. For details, see documentation to the [corresponging ITK class][HTOMIF].
Parameter dimension is an integer that determines the kind of features
that are highlighed. Use 0 for blobs, 1 for tubes, 2 for pancakes, etc. The
min and max scale parameters are floating point values, giving the scale of
the features highlighted, in physical units. Typically, just one scale is
used.
Detect vessel-like structures at scale 0.5mm
c3d image.nii.gz -hessobj 1 0.5 0.5
[HTOMIF] http://www.itk.org/Doxygen/html/classitk_1_1HessianToObjectnessMeasureImageFilter.html.
-hessobj, -hessian-objectness: Hessian objectness filter
Syntax: -hessobj <dimension> <min_scale> <max_scale>
Also known as the Frangi vesselness filter, this filter can be used to highlight tube-like, sheet-like and blob-like objects in the image. For details, see documentation to the [corresponging ITK class][HTOMIF].
Parameter dimension is an integer that determines the kind of features
that are highlighed. Use 0 for blobs, 1 for tubes, 2 for pancakes, etc. The
min and max scale parameters are floating point values, giving the scale of
the features highlighted, in physical units. Typically, just one scale is
used.
Detect vessel-like structures at scale 0.5mm
c3d image.nii.gz -hessobj 1 0.5 0.5
[HTOMIF] http://www.itk.org/Doxygen/html/classitk_1_1HessianToObjectnessMeasureImageFilter.html
2573 def run( 2574 self, 2575 execution: Execution, 2576 ) -> list[str]: 2577 """ 2578 Build command line arguments. This method is called by the main command. 2579 2580 Args: 2581 execution: The execution object. 2582 Returns: 2583 Command line arguments 2584 """ 2585 cargs = [] 2586 cargs.extend([ 2587 "-hessobj", 2588 self.hessian_objectness 2589 ]) 2590 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2593@dataclasses.dataclass 2594class C3dHistogramMatch: 2595 """ 2596 No description found. 2597 """ 2598 histogram_match: str 2599 """No description found.""" 2600 2601 def run( 2602 self, 2603 execution: Execution, 2604 ) -> list[str]: 2605 """ 2606 Build command line arguments. This method is called by the main command. 2607 2608 Args: 2609 execution: The execution object. 2610 Returns: 2611 Command line arguments 2612 """ 2613 cargs = [] 2614 cargs.extend([ 2615 "-histmatch", 2616 self.histogram_match 2617 ]) 2618 return cargs
No description found.
2601 def run( 2602 self, 2603 execution: Execution, 2604 ) -> list[str]: 2605 """ 2606 Build command line arguments. This method is called by the main command. 2607 2608 Args: 2609 execution: The execution object. 2610 Returns: 2611 Command line arguments 2612 """ 2613 cargs = [] 2614 cargs.extend([ 2615 "-histmatch", 2616 self.histogram_match 2617 ]) 2618 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2423@dataclasses.dataclass 2424class C3dHolefill: 2425 """ 2426 -holefill: Fill holes in binary image 2427 2428 Syntax: `-holefill intensity_value [0|1] ` 2429 2430 Apply the binary hole filling algorithm to a particular intensity value in 2431 the image. The input image is typically a binary image or a multi-label 2432 segmentation image. Holes (voxels not matching the specified intensity value 2433 that are completely contained by voxels matching this value) are filled. The 2434 second parameter specifies what type of topological connectivity is used to 2435 determine holes. The value 0 uses the default algorithm in ITK (face 2436 connectivity) and 1 uses the full connectivity variant (face, edge and 2437 vertex connectivity). For more details see the [ITK page for this 2438 algorithm][7]. 2439 2440 c3d segmentation.nii.gz -holefill 5 0 -type uchar -o filledlabel5.nii.gz. 2441 """ 2442 holefill: str 2443 """-holefill: Fill holes in binary image 2444 2445 Syntax: `-holefill intensity_value [0|1] ` 2446 2447 Apply the binary hole filling algorithm to a particular intensity value in 2448 the image. The input image is typically a binary image or a multi-label 2449 segmentation image. Holes (voxels not matching the specified intensity value 2450 that are completely contained by voxels matching this value) are filled. The 2451 second parameter specifies what type of topological connectivity is used to 2452 determine holes. The value 0 uses the default algorithm in ITK (face 2453 connectivity) and 1 uses the full connectivity variant (face, edge and 2454 vertex connectivity). For more details see the [ITK page for this 2455 algorithm][7]. 2456 2457 c3d segmentation.nii.gz -holefill 5 0 -type uchar -o filledlabel5.nii.gz""" 2458 2459 def run( 2460 self, 2461 execution: Execution, 2462 ) -> list[str]: 2463 """ 2464 Build command line arguments. This method is called by the main command. 2465 2466 Args: 2467 execution: The execution object. 2468 Returns: 2469 Command line arguments 2470 """ 2471 cargs = [] 2472 cargs.extend([ 2473 "-hf", 2474 self.holefill 2475 ]) 2476 return cargs
-holefill: Fill holes in binary image
Syntax: -holefill intensity_value [0|1]
Apply the binary hole filling algorithm to a particular intensity value in the image. The input image is typically a binary image or a multi-label segmentation image. Holes (voxels not matching the specified intensity value that are completely contained by voxels matching this value) are filled. The second parameter specifies what type of topological connectivity is used to determine holes. The value 0 uses the default algorithm in ITK (face connectivity) and 1 uses the full connectivity variant (face, edge and vertex connectivity). For more details see the [ITK page for this algorithm][7].
c3d segmentation.nii.gz -holefill 5 0 -type uchar -o filledlabel5.nii.gz.
-holefill: Fill holes in binary image
Syntax: -holefill intensity_value [0|1]
Apply the binary hole filling algorithm to a particular intensity value in the image. The input image is typically a binary image or a multi-label segmentation image. Holes (voxels not matching the specified intensity value that are completely contained by voxels matching this value) are filled. The second parameter specifies what type of topological connectivity is used to determine holes. The value 0 uses the default algorithm in ITK (face connectivity) and 1 uses the full connectivity variant (face, edge and vertex connectivity). For more details see the [ITK page for this algorithm][7].
c3d segmentation.nii.gz -holefill 5 0 -type uchar -o filledlabel5.nii.gz
2459 def run( 2460 self, 2461 execution: Execution, 2462 ) -> list[str]: 2463 """ 2464 Build command line arguments. This method is called by the main command. 2465 2466 Args: 2467 execution: The execution object. 2468 Returns: 2469 Command line arguments 2470 """ 2471 cargs = [] 2472 cargs.extend([ 2473 "-hf", 2474 self.holefill 2475 ]) 2476 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2621@dataclasses.dataclass 2622class C3dInfo: 2623 """ 2624 -info: Display brief image information 2625 2626 Syntax: `-info` 2627 2628 Prints brief information about the last image on the stack. Does not affect 2629 the stack. 2630 2631 c3d image.hdr -info 2632 2633 Use with the **-foreach** command to get information on multiple images 2634 2635 c3d images*.nii -foreach -info -endfor. 2636 """ 2637 info: str 2638 """-info: Display brief image information 2639 2640 Syntax: `-info` 2641 2642 Prints brief information about the last image on the stack. Does not affect 2643 the stack. 2644 2645 c3d image.hdr -info 2646 2647 Use with the **-foreach** command to get information on multiple images 2648 2649 c3d images*.nii -foreach -info -endfor""" 2650 2651 def run( 2652 self, 2653 execution: Execution, 2654 ) -> list[str]: 2655 """ 2656 Build command line arguments. This method is called by the main command. 2657 2658 Args: 2659 execution: The execution object. 2660 Returns: 2661 Command line arguments 2662 """ 2663 cargs = [] 2664 cargs.extend([ 2665 "-info", 2666 self.info 2667 ]) 2668 return cargs
-info: Display brief image information
Syntax: -info
Prints brief information about the last image on the stack. Does not affect the stack.
c3d image.hdr -info
Use with the -foreach command to get information on multiple images
c3d images*.nii -foreach -info -endfor.
-info: Display brief image information
Syntax: -info
Prints brief information about the last image on the stack. Does not affect the stack.
c3d image.hdr -info
Use with the -foreach command to get information on multiple images
c3d images*.nii -foreach -info -endfor
2651 def run( 2652 self, 2653 execution: Execution, 2654 ) -> list[str]: 2655 """ 2656 Build command line arguments. This method is called by the main command. 2657 2658 Args: 2659 execution: The execution object. 2660 Returns: 2661 Command line arguments 2662 """ 2663 cargs = [] 2664 cargs.extend([ 2665 "-info", 2666 self.info 2667 ]) 2668 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2671@dataclasses.dataclass 2672class C3dInfoFull: 2673 """ 2674 -info-full: Display verbose image information 2675 2676 Syntax: `-info-full` 2677 2678 Prints extended information about the last image on the stack, such as the 2679 metadata dictionary. For example, 2680 2681 c3d image.hdr -info-full. 2682 """ 2683 info_full: str 2684 """-info-full: Display verbose image information 2685 2686 Syntax: `-info-full` 2687 2688 Prints extended information about the last image on the stack, such as the 2689 metadata dictionary. For example, 2690 2691 c3d image.hdr -info-full""" 2692 2693 def run( 2694 self, 2695 execution: Execution, 2696 ) -> list[str]: 2697 """ 2698 Build command line arguments. This method is called by the main command. 2699 2700 Args: 2701 execution: The execution object. 2702 Returns: 2703 Command line arguments 2704 """ 2705 cargs = [] 2706 cargs.extend([ 2707 "-info-full", 2708 self.info_full 2709 ]) 2710 return cargs
-info-full: Display verbose image information
Syntax: -info-full
Prints extended information about the last image on the stack, such as the metadata dictionary. For example,
c3d image.hdr -info-full.
-info-full: Display verbose image information
Syntax: -info-full
Prints extended information about the last image on the stack, such as the metadata dictionary. For example,
c3d image.hdr -info-full
2693 def run( 2694 self, 2695 execution: Execution, 2696 ) -> list[str]: 2697 """ 2698 Build command line arguments. This method is called by the main command. 2699 2700 Args: 2701 execution: The execution object. 2702 Returns: 2703 Command line arguments 2704 """ 2705 cargs = [] 2706 cargs.extend([ 2707 "-info-full", 2708 self.info_full 2709 ]) 2710 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2713@dataclasses.dataclass 2714class C3dInsert: 2715 """ 2716 -insert: Insert image anywhere in the stack 2717 2718 Syntax: `-insert var pos` 2719 2720 This command is similar to **-push**, but allows you to insert the image 2721 associated with 'var' at any position in the stack, counting from the end. 2722 When 'pos' is 0, the image is placed at the end of the stack (same as 2723 **-push**). When pos is one, the image is placed at the next-to-end 2724 position, and so on. 2725 """ 2726 insert: str 2727 """-insert: Insert image anywhere in the stack 2728 2729 Syntax: `-insert var pos` 2730 2731 This command is similar to **-push**, but allows you to insert the image 2732 associated with 'var' at any position in the stack, counting from the end. 2733 When 'pos' is 0, the image is placed at the end of the stack (same as 2734 **-push**). When pos is one, the image is placed at the next-to-end 2735 position, and so on.""" 2736 2737 def run( 2738 self, 2739 execution: Execution, 2740 ) -> list[str]: 2741 """ 2742 Build command line arguments. This method is called by the main command. 2743 2744 Args: 2745 execution: The execution object. 2746 Returns: 2747 Command line arguments 2748 """ 2749 cargs = [] 2750 cargs.extend([ 2751 "-insert", 2752 self.insert 2753 ]) 2754 return cargs
-insert: Insert image anywhere in the stack
Syntax: -insert var pos
This command is similar to -push, but allows you to insert the image associated with 'var' at any position in the stack, counting from the end. When 'pos' is 0, the image is placed at the end of the stack (same as -push). When pos is one, the image is placed at the next-to-end position, and so on.
-insert: Insert image anywhere in the stack
Syntax: -insert var pos
This command is similar to -push, but allows you to insert the image associated with 'var' at any position in the stack, counting from the end. When 'pos' is 0, the image is placed at the end of the stack (same as -push). When pos is one, the image is placed at the next-to-end position, and so on.
2737 def run( 2738 self, 2739 execution: Execution, 2740 ) -> list[str]: 2741 """ 2742 Build command line arguments. This method is called by the main command. 2743 2744 Args: 2745 execution: The execution object. 2746 Returns: 2747 Command line arguments 2748 """ 2749 cargs = [] 2750 cargs.extend([ 2751 "-insert", 2752 self.insert 2753 ]) 2754 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2757@dataclasses.dataclass 2758class C3dInterpolation: 2759 """ 2760 -interpolation: Set interpolation mode 2761 2762 Syntax: `-interpolation <NearestNeighbor|Linear|Cubic|Sinc|Gaussian> 2763 [param]` 2764 2765 Specifies the interpolation used with **-resample** and other commands. 2766 Default is **Linear**. Gaussian interpolation takes as the parameter the 2767 standard deviation of the Gaussian filter (e.g, 1mm). Gaussian interpolation 2768 is very similar in result to first smoothing an image with a Gaussian filter 2769 and then reslicing it with linear interpolation, but is more accurate and 2770 has less aliasing artifacts. It is also slower, and should only be used with 2771 small sigmas (a few voxels across). 2772 2773 Shorthand 0 can be used for *NearestNeighbor*, 1 for *Linear* and 3 for 2774 *Cubic*. For example: 2775 2776 c3d -int 3 test.nii -resample 200x200x200% -o cubic_supersample.nii. 2777 """ 2778 interpolation: str 2779 """-interpolation: Set interpolation mode 2780 2781 Syntax: `-interpolation <NearestNeighbor|Linear|Cubic|Sinc|Gaussian> 2782 [param]` 2783 2784 Specifies the interpolation used with **-resample** and other commands. 2785 Default is **Linear**. Gaussian interpolation takes as the parameter the 2786 standard deviation of the Gaussian filter (e.g, 1mm). Gaussian interpolation 2787 is very similar in result to first smoothing an image with a Gaussian filter 2788 and then reslicing it with linear interpolation, but is more accurate and 2789 has less aliasing artifacts. It is also slower, and should only be used with 2790 small sigmas (a few voxels across). 2791 2792 Shorthand 0 can be used for *NearestNeighbor*, 1 for *Linear* and 3 for 2793 *Cubic*. For example: 2794 2795 c3d -int 3 test.nii -resample 200x200x200% -o cubic_supersample.nii""" 2796 2797 def run( 2798 self, 2799 execution: Execution, 2800 ) -> list[str]: 2801 """ 2802 Build command line arguments. This method is called by the main command. 2803 2804 Args: 2805 execution: The execution object. 2806 Returns: 2807 Command line arguments 2808 """ 2809 cargs = [] 2810 cargs.extend([ 2811 "-interpolation", 2812 self.interpolation 2813 ]) 2814 return cargs
-interpolation: Set interpolation mode
Syntax: -interpolation <NearestNeighbor|Linear|Cubic|Sinc|Gaussian>
[param]
Specifies the interpolation used with -resample and other commands. Default is Linear. Gaussian interpolation takes as the parameter the standard deviation of the Gaussian filter (e.g, 1mm). Gaussian interpolation is very similar in result to first smoothing an image with a Gaussian filter and then reslicing it with linear interpolation, but is more accurate and has less aliasing artifacts. It is also slower, and should only be used with small sigmas (a few voxels across).
Shorthand 0 can be used for NearestNeighbor, 1 for Linear and 3 for Cubic. For example:
c3d -int 3 test.nii -resample 200x200x200% -o cubic_supersample.nii.
-interpolation: Set interpolation mode
Syntax: -interpolation <NearestNeighbor|Linear|Cubic|Sinc|Gaussian>
[param]
Specifies the interpolation used with -resample and other commands. Default is Linear. Gaussian interpolation takes as the parameter the standard deviation of the Gaussian filter (e.g, 1mm). Gaussian interpolation is very similar in result to first smoothing an image with a Gaussian filter and then reslicing it with linear interpolation, but is more accurate and has less aliasing artifacts. It is also slower, and should only be used with small sigmas (a few voxels across).
Shorthand 0 can be used for NearestNeighbor, 1 for Linear and 3 for Cubic. For example:
c3d -int 3 test.nii -resample 200x200x200% -o cubic_supersample.nii
2797 def run( 2798 self, 2799 execution: Execution, 2800 ) -> list[str]: 2801 """ 2802 Build command line arguments. This method is called by the main command. 2803 2804 Args: 2805 execution: The execution object. 2806 Returns: 2807 Command line arguments 2808 """ 2809 cargs = [] 2810 cargs.extend([ 2811 "-interpolation", 2812 self.interpolation 2813 ]) 2814 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2817@dataclasses.dataclass 2818class C3dIterations: 2819 """ 2820 No description found. 2821 """ 2822 iterations: str 2823 """No description found.""" 2824 2825 def run( 2826 self, 2827 execution: Execution, 2828 ) -> list[str]: 2829 """ 2830 Build command line arguments. This method is called by the main command. 2831 2832 Args: 2833 execution: The execution object. 2834 Returns: 2835 Command line arguments 2836 """ 2837 cargs = [] 2838 cargs.extend([ 2839 "-iterations", 2840 self.iterations 2841 ]) 2842 return cargs
No description found.
2825 def run( 2826 self, 2827 execution: Execution, 2828 ) -> list[str]: 2829 """ 2830 Build command line arguments. This method is called by the main command. 2831 2832 Args: 2833 execution: The execution object. 2834 Returns: 2835 Command line arguments 2836 """ 2837 cargs = [] 2838 cargs.extend([ 2839 "-iterations", 2840 self.iterations 2841 ]) 2842 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2845@dataclasses.dataclass 2846class C3dLabelOverlap: 2847 """ 2848 No description found. 2849 """ 2850 label_overlap: str 2851 """No description found.""" 2852 2853 def run( 2854 self, 2855 execution: Execution, 2856 ) -> list[str]: 2857 """ 2858 Build command line arguments. This method is called by the main command. 2859 2860 Args: 2861 execution: The execution object. 2862 Returns: 2863 Command line arguments 2864 """ 2865 cargs = [] 2866 cargs.extend([ 2867 "-label-overlap", 2868 self.label_overlap 2869 ]) 2870 return cargs
No description found.
2853 def run( 2854 self, 2855 execution: Execution, 2856 ) -> list[str]: 2857 """ 2858 Build command line arguments. This method is called by the main command. 2859 2860 Args: 2861 execution: The execution object. 2862 Returns: 2863 Command line arguments 2864 """ 2865 cargs = [] 2866 cargs.extend([ 2867 "-label-overlap", 2868 self.label_overlap 2869 ]) 2870 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2873@dataclasses.dataclass 2874class C3dLabelStatistics: 2875 """ 2876 -lstat, -label-statistics: Display segmentation volumes and intensity 2877 statistics 2878 2879 Syntax: `-lstat` 2880 2881 Given a grayscale image and a multilabel (or binary) image, this command 2882 computes the statistics for every label in the latter, including volumes, 2883 average grayscale intensity, etc. For instance, if image *mri.nii* is a 2884 medical image and *seg.nii* is a multilabel segmentation of the image with 2885 labels 0, 1 and 4, the following command can be used to print the statistics 2886 of the intensity of *mri.nii* for each of the labels 2887 2888 c3d mri.nii seg.nii -lstat 2889 2890 The output contains the mean, standard deviation, maximum intensity and 2891 minimum intensity for each label. If you just need volumes from a 2892 multi-label image, use **-dup** command as follows: 2893 2894 c3d seg.nii -dup -lstat. 2895 """ 2896 label_statistics: str 2897 """-lstat, -label-statistics: Display segmentation volumes and intensity 2898 statistics 2899 2900 Syntax: `-lstat` 2901 2902 Given a grayscale image and a multilabel (or binary) image, this command 2903 computes the statistics for every label in the latter, including volumes, 2904 average grayscale intensity, etc. For instance, if image *mri.nii* is a 2905 medical image and *seg.nii* is a multilabel segmentation of the image with 2906 labels 0, 1 and 4, the following command can be used to print the statistics 2907 of the intensity of *mri.nii* for each of the labels 2908 2909 c3d mri.nii seg.nii -lstat 2910 2911 The output contains the mean, standard deviation, maximum intensity and 2912 minimum intensity for each label. If you just need volumes from a 2913 multi-label image, use **-dup** command as follows: 2914 2915 c3d seg.nii -dup -lstat""" 2916 2917 def run( 2918 self, 2919 execution: Execution, 2920 ) -> list[str]: 2921 """ 2922 Build command line arguments. This method is called by the main command. 2923 2924 Args: 2925 execution: The execution object. 2926 Returns: 2927 Command line arguments 2928 """ 2929 cargs = [] 2930 cargs.extend([ 2931 "-label-statistics", 2932 self.label_statistics 2933 ]) 2934 return cargs
-lstat, -label-statistics: Display segmentation volumes and intensity statistics
Syntax: -lstat
Given a grayscale image and a multilabel (or binary) image, this command computes the statistics for every label in the latter, including volumes, average grayscale intensity, etc. For instance, if image mri.nii is a medical image and seg.nii is a multilabel segmentation of the image with labels 0, 1 and 4, the following command can be used to print the statistics of the intensity of mri.nii for each of the labels
c3d mri.nii seg.nii -lstat
The output contains the mean, standard deviation, maximum intensity and minimum intensity for each label. If you just need volumes from a multi-label image, use -dup command as follows:
c3d seg.nii -dup -lstat.
-lstat, -label-statistics: Display segmentation volumes and intensity statistics
Syntax: -lstat
Given a grayscale image and a multilabel (or binary) image, this command computes the statistics for every label in the latter, including volumes, average grayscale intensity, etc. For instance, if image mri.nii is a medical image and seg.nii is a multilabel segmentation of the image with labels 0, 1 and 4, the following command can be used to print the statistics of the intensity of mri.nii for each of the labels
c3d mri.nii seg.nii -lstat
The output contains the mean, standard deviation, maximum intensity and minimum intensity for each label. If you just need volumes from a multi-label image, use -dup command as follows:
c3d seg.nii -dup -lstat
2917 def run( 2918 self, 2919 execution: Execution, 2920 ) -> list[str]: 2921 """ 2922 Build command line arguments. This method is called by the main command. 2923 2924 Args: 2925 execution: The execution object. 2926 Returns: 2927 Command line arguments 2928 """ 2929 cargs = [] 2930 cargs.extend([ 2931 "-label-statistics", 2932 self.label_statistics 2933 ]) 2934 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2937@dataclasses.dataclass 2938class C3dLandmarksToSpheres: 2939 """ 2940 No description found. 2941 """ 2942 landmarks_to_spheres: str 2943 """No description found.""" 2944 2945 def run( 2946 self, 2947 execution: Execution, 2948 ) -> list[str]: 2949 """ 2950 Build command line arguments. This method is called by the main command. 2951 2952 Args: 2953 execution: The execution object. 2954 Returns: 2955 Command line arguments 2956 """ 2957 cargs = [] 2958 cargs.extend([ 2959 "-landmarks-to-spheres", 2960 self.landmarks_to_spheres 2961 ]) 2962 return cargs
No description found.
2945 def run( 2946 self, 2947 execution: Execution, 2948 ) -> list[str]: 2949 """ 2950 Build command line arguments. This method is called by the main command. 2951 2952 Args: 2953 execution: The execution object. 2954 Returns: 2955 Command line arguments 2956 """ 2957 cargs = [] 2958 cargs.extend([ 2959 "-landmarks-to-spheres", 2960 self.landmarks_to_spheres 2961 ]) 2962 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2965@dataclasses.dataclass 2966class C3dLaplacian: 2967 """ 2968 -laplacian, -laplace: Laplacian filter 2969 2970 Syntax: `-laplacian` 2971 2972 Applies the Laplacian filter to the image. Used to detect ridges of 2973 intensity. Typically, used with the **-smooth** option to obtain the 2974 equivalent of convolving the image with the *Laplacian of the Gaussian 2975 (LoG)* kernel: 2976 2977 c3d input.img -smooth 1.2vox -laplacian -o output.img. 2978 """ 2979 laplacian: str 2980 """-laplacian, -laplace: Laplacian filter 2981 2982 Syntax: `-laplacian` 2983 2984 Applies the Laplacian filter to the image. Used to detect ridges of 2985 intensity. Typically, used with the **-smooth** option to obtain the 2986 equivalent of convolving the image with the *Laplacian of the Gaussian 2987 (LoG)* kernel: 2988 2989 c3d input.img -smooth 1.2vox -laplacian -o output.img""" 2990 2991 def run( 2992 self, 2993 execution: Execution, 2994 ) -> list[str]: 2995 """ 2996 Build command line arguments. This method is called by the main command. 2997 2998 Args: 2999 execution: The execution object. 3000 Returns: 3001 Command line arguments 3002 """ 3003 cargs = [] 3004 cargs.extend([ 3005 "-laplacian", 3006 self.laplacian 3007 ]) 3008 return cargs
-laplacian, -laplace: Laplacian filter
Syntax: -laplacian
Applies the Laplacian filter to the image. Used to detect ridges of intensity. Typically, used with the -smooth option to obtain the equivalent of convolving the image with the Laplacian of the Gaussian (LoG) kernel:
c3d input.img -smooth 1.2vox -laplacian -o output.img.
-laplacian, -laplace: Laplacian filter
Syntax: -laplacian
Applies the Laplacian filter to the image. Used to detect ridges of intensity. Typically, used with the -smooth option to obtain the equivalent of convolving the image with the Laplacian of the Gaussian (LoG) kernel:
c3d input.img -smooth 1.2vox -laplacian -o output.img
2991 def run( 2992 self, 2993 execution: Execution, 2994 ) -> list[str]: 2995 """ 2996 Build command line arguments. This method is called by the main command. 2997 2998 Args: 2999 execution: The execution object. 3000 Returns: 3001 Command line arguments 3002 """ 3003 cargs = [] 3004 cargs.extend([ 3005 "-laplacian", 3006 self.laplacian 3007 ]) 3008 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3011@dataclasses.dataclass 3012class C3dLevelset: 3013 """ 3014 -levelset: Level set segmentation 3015 3016 Syntax: `-levelset n_iter ` 3017 3018 Perform level set segmentation for *n\_iter* iterations, like in ITK-SNAP. 3019 The last image on the stack is treated as the initialization image and the 3020 next-to-last image on the stack is the speed image. Both images should be in 3021 the range between -1 and 1. Here is how the signs of the different images 3022 are interpreted 3023 3024 | | Speed Image | Initialization Image | Output Image | 3025 | -- | ------------- | -------------------- | ------------ | 3026 | +1 | Foreground | Outside | Outside | 3027 | -1 | Background | Inside | Inside | 3028 3029 Here is an example where you have the speed and the initialization given: 3030 3031 c3d speed.img initial.img -levelset-curvature 0.5 -levelset 100 -o seg.img 3032 3033 Here is an example of segmenting the ventricles in an MRI image, where the 3034 ventricles and other CSF have intensity below 715. The image 3035 seg_bubbles.nii.gz in this example is a binary image of the initialization 3036 seeds (1 inside the seeds, 0 outside). 3037 3038 c3d brain.nii.gz -erf 715 100 -scale -1 seg_bubbles.nii.gz \ 3039 -replace 0 1 1 -1 -levelset-curvature 0.2 -levelset 500 \ 3040 -thresh -inf 0 1 0 -o segmentation.nii.gz 3041 3042 Another example of smoothing a binary image that is useful for cleaning up 3043 manual segmentations. Here the speed image is positive inside the binary 3044 object, and the initialization is negative inside the object. The command 3045 writes out both the level set image (whose 0-level set is the smoothed 3046 boundary of the binary object) and the smoothed binary object 3047 3048 c3d binary.img -threshold 1 inf 1 -1 -binary.img 1 inf 1 -1 \ 3049 -levelset-curvature 1.5 -levelset 100 -o levelset.img \ 3050 -thresh -inf 0 1 0 -o smoothed_binary.img. 3051 """ 3052 levelset: str 3053 """-levelset: Level set segmentation 3054 3055 Syntax: `-levelset n_iter ` 3056 3057 Perform level set segmentation for *n\_iter* iterations, like in ITK-SNAP. 3058 The last image on the stack is treated as the initialization image and the 3059 next-to-last image on the stack is the speed image. Both images should be in 3060 the range between -1 and 1. Here is how the signs of the different images 3061 are interpreted 3062 3063 | | Speed Image | Initialization Image | Output Image | 3064 | -- | ------------- | -------------------- | ------------ | 3065 | +1 | Foreground | Outside | Outside | 3066 | -1 | Background | Inside | Inside | 3067 3068 Here is an example where you have the speed and the initialization given: 3069 3070 c3d speed.img initial.img -levelset-curvature 0.5 -levelset 100 -o seg.img 3071 3072 Here is an example of segmenting the ventricles in an MRI image, where the 3073 ventricles and other CSF have intensity below 715. The image 3074 seg_bubbles.nii.gz in this example is a binary image of the initialization 3075 seeds (1 inside the seeds, 0 outside). 3076 3077 c3d brain.nii.gz -erf 715 100 -scale -1 seg_bubbles.nii.gz \ 3078 -replace 0 1 1 -1 -levelset-curvature 0.2 -levelset 500 \ 3079 -thresh -inf 0 1 0 -o segmentation.nii.gz 3080 3081 Another example of smoothing a binary image that is useful for cleaning up 3082 manual segmentations. Here the speed image is positive inside the binary 3083 object, and the initialization is negative inside the object. The command 3084 writes out both the level set image (whose 0-level set is the smoothed 3085 boundary of the binary object) and the smoothed binary object 3086 3087 c3d binary.img -threshold 1 inf 1 -1 -binary.img 1 inf 1 -1 \ 3088 -levelset-curvature 1.5 -levelset 100 -o levelset.img \ 3089 -thresh -inf 0 1 0 -o smoothed_binary.img""" 3090 3091 def run( 3092 self, 3093 execution: Execution, 3094 ) -> list[str]: 3095 """ 3096 Build command line arguments. This method is called by the main command. 3097 3098 Args: 3099 execution: The execution object. 3100 Returns: 3101 Command line arguments 3102 """ 3103 cargs = [] 3104 cargs.extend([ 3105 "-levelset", 3106 self.levelset 3107 ]) 3108 return cargs
-levelset: Level set segmentation
Syntax: -levelset n_iter
Perform level set segmentation for n_iter iterations, like in ITK-SNAP. The last image on the stack is treated as the initialization image and the next-to-last image on the stack is the speed image. Both images should be in the range between -1 and 1. Here is how the signs of the different images are interpreted
| Speed Image | Initialization Image | Output Image | |
|---|---|---|---|
| +1 | Foreground | Outside | Outside |
| -1 | Background | Inside | Inside |
Here is an example where you have the speed and the initialization given:
c3d speed.img initial.img -levelset-curvature 0.5 -levelset 100 -o seg.img
Here is an example of segmenting the ventricles in an MRI image, where the ventricles and other CSF have intensity below 715. The image seg_bubbles.nii.gz in this example is a binary image of the initialization seeds (1 inside the seeds, 0 outside).
c3d brain.nii.gz -erf 715 100 -scale -1 seg_bubbles.nii.gz -replace 0 1 1 -1 -levelset-curvature 0.2 -levelset 500 -thresh -inf 0 1 0 -o segmentation.nii.gz
Another example of smoothing a binary image that is useful for cleaning up manual segmentations. Here the speed image is positive inside the binary object, and the initialization is negative inside the object. The command writes out both the level set image (whose 0-level set is the smoothed boundary of the binary object) and the smoothed binary object
c3d binary.img -threshold 1 inf 1 -1 -binary.img 1 inf 1 -1 -levelset-curvature 1.5 -levelset 100 -o levelset.img -thresh -inf 0 1 0 -o smoothed_binary.img.
-levelset: Level set segmentation
Syntax: -levelset n_iter
Perform level set segmentation for n_iter iterations, like in ITK-SNAP. The last image on the stack is treated as the initialization image and the next-to-last image on the stack is the speed image. Both images should be in the range between -1 and 1. Here is how the signs of the different images are interpreted
| Speed Image | Initialization Image | Output Image | |
|---|---|---|---|
| +1 | Foreground | Outside | Outside |
| -1 | Background | Inside | Inside |
Here is an example where you have the speed and the initialization given:
c3d speed.img initial.img -levelset-curvature 0.5 -levelset 100 -o seg.img
Here is an example of segmenting the ventricles in an MRI image, where the ventricles and other CSF have intensity below 715. The image seg_bubbles.nii.gz in this example is a binary image of the initialization seeds (1 inside the seeds, 0 outside).
c3d brain.nii.gz -erf 715 100 -scale -1 seg_bubbles.nii.gz -replace 0 1 1 -1 -levelset-curvature 0.2 -levelset 500 -thresh -inf 0 1 0 -o segmentation.nii.gz
Another example of smoothing a binary image that is useful for cleaning up manual segmentations. Here the speed image is positive inside the binary object, and the initialization is negative inside the object. The command writes out both the level set image (whose 0-level set is the smoothed boundary of the binary object) and the smoothed binary object
c3d binary.img -threshold 1 inf 1 -1 -binary.img 1 inf 1 -1 -levelset-curvature 1.5 -levelset 100 -o levelset.img -thresh -inf 0 1 0 -o smoothed_binary.img
3091 def run( 3092 self, 3093 execution: Execution, 3094 ) -> list[str]: 3095 """ 3096 Build command line arguments. This method is called by the main command. 3097 3098 Args: 3099 execution: The execution object. 3100 Returns: 3101 Command line arguments 3102 """ 3103 cargs = [] 3104 cargs.extend([ 3105 "-levelset", 3106 self.levelset 3107 ]) 3108 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3139@dataclasses.dataclass 3140class C3dLevelsetAdvection: 3141 """ 3142 No description found. 3143 """ 3144 levelset_advection: str 3145 """No description found.""" 3146 3147 def run( 3148 self, 3149 execution: Execution, 3150 ) -> list[str]: 3151 """ 3152 Build command line arguments. This method is called by the main command. 3153 3154 Args: 3155 execution: The execution object. 3156 Returns: 3157 Command line arguments 3158 """ 3159 cargs = [] 3160 cargs.extend([ 3161 "-levelset-advection", 3162 self.levelset_advection 3163 ]) 3164 return cargs
No description found.
3147 def run( 3148 self, 3149 execution: Execution, 3150 ) -> list[str]: 3151 """ 3152 Build command line arguments. This method is called by the main command. 3153 3154 Args: 3155 execution: The execution object. 3156 Returns: 3157 Command line arguments 3158 """ 3159 cargs = [] 3160 cargs.extend([ 3161 "-levelset-advection", 3162 self.levelset_advection 3163 ]) 3164 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3111@dataclasses.dataclass 3112class C3dLevelsetCurvature: 3113 """ 3114 No description found. 3115 """ 3116 levelset_curvature: str 3117 """No description found.""" 3118 3119 def run( 3120 self, 3121 execution: Execution, 3122 ) -> list[str]: 3123 """ 3124 Build command line arguments. This method is called by the main command. 3125 3126 Args: 3127 execution: The execution object. 3128 Returns: 3129 Command line arguments 3130 """ 3131 cargs = [] 3132 cargs.extend([ 3133 "-levelset-curvature", 3134 self.levelset_curvature 3135 ]) 3136 return cargs
No description found.
3119 def run( 3120 self, 3121 execution: Execution, 3122 ) -> list[str]: 3123 """ 3124 Build command line arguments. This method is called by the main command. 3125 3126 Args: 3127 execution: The execution object. 3128 Returns: 3129 Command line arguments 3130 """ 3131 cargs = [] 3132 cargs.extend([ 3133 "-levelset-curvature", 3134 self.levelset_curvature 3135 ]) 3136 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3167@dataclasses.dataclass 3168class C3dLog: 3169 """ 3170 -log, -ln: Voxelwise natural logarithm 3171 3172 Syntax: `-log` 3173 3174 Computes natural logarithm of each voxel in the last image on the stack. 3175 """ 3176 log: str 3177 """-log, -ln: Voxelwise natural logarithm 3178 3179 Syntax: `-log` 3180 3181 Computes natural logarithm of each voxel in the last image on the stack.""" 3182 3183 def run( 3184 self, 3185 execution: Execution, 3186 ) -> list[str]: 3187 """ 3188 Build command line arguments. This method is called by the main command. 3189 3190 Args: 3191 execution: The execution object. 3192 Returns: 3193 Command line arguments 3194 """ 3195 cargs = [] 3196 cargs.extend([ 3197 "-ln", 3198 self.log 3199 ]) 3200 return cargs
-log, -ln: Voxelwise natural logarithm
Syntax: -log
Computes natural logarithm of each voxel in the last image on the stack.
-log, -ln: Voxelwise natural logarithm
Syntax: -log
Computes natural logarithm of each voxel in the last image on the stack.
3183 def run( 3184 self, 3185 execution: Execution, 3186 ) -> list[str]: 3187 """ 3188 Build command line arguments. This method is called by the main command. 3189 3190 Args: 3191 execution: The execution object. 3192 Returns: 3193 Command line arguments 3194 """ 3195 cargs = [] 3196 cargs.extend([ 3197 "-ln", 3198 self.log 3199 ]) 3200 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3203@dataclasses.dataclass 3204class C3dLog10: 3205 """ 3206 -log10: Voxelwise base 10 logarithm 3207 3208 Syntax: `-log10` 3209 3210 Computes base 10 logarithm of each voxel in the last image on the stack. 3211 """ 3212 log10: str 3213 """-log10: Voxelwise base 10 logarithm 3214 3215 Syntax: `-log10` 3216 3217 Computes base 10 logarithm of each voxel in the last image on the stack.""" 3218 3219 def run( 3220 self, 3221 execution: Execution, 3222 ) -> list[str]: 3223 """ 3224 Build command line arguments. This method is called by the main command. 3225 3226 Args: 3227 execution: The execution object. 3228 Returns: 3229 Command line arguments 3230 """ 3231 cargs = [] 3232 cargs.extend([ 3233 "-log10", 3234 self.log10 3235 ]) 3236 return cargs
-log10: Voxelwise base 10 logarithm
Syntax: -log10
Computes base 10 logarithm of each voxel in the last image on the stack.
-log10: Voxelwise base 10 logarithm
Syntax: -log10
Computes base 10 logarithm of each voxel in the last image on the stack.
3219 def run( 3220 self, 3221 execution: Execution, 3222 ) -> list[str]: 3223 """ 3224 Build command line arguments. This method is called by the main command. 3225 3226 Args: 3227 execution: The execution object. 3228 Returns: 3229 Command line arguments 3230 """ 3231 cargs = [] 3232 cargs.extend([ 3233 "-log10", 3234 self.log10 3235 ]) 3236 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3239@dataclasses.dataclass 3240class C3dManual: 3241 """ 3242 No description found. 3243 """ 3244 manual: str 3245 """No description found.""" 3246 3247 def run( 3248 self, 3249 execution: Execution, 3250 ) -> list[str]: 3251 """ 3252 Build command line arguments. This method is called by the main command. 3253 3254 Args: 3255 execution: The execution object. 3256 Returns: 3257 Command line arguments 3258 """ 3259 cargs = [] 3260 cargs.extend([ 3261 "-manual", 3262 self.manual 3263 ]) 3264 return cargs
No description found.
3247 def run( 3248 self, 3249 execution: Execution, 3250 ) -> list[str]: 3251 """ 3252 Build command line arguments. This method is called by the main command. 3253 3254 Args: 3255 execution: The execution object. 3256 Returns: 3257 Command line arguments 3258 """ 3259 cargs = [] 3260 cargs.extend([ 3261 "-manual", 3262 self.manual 3263 ]) 3264 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3267@dataclasses.dataclass 3268class C3dMatchBoundingBox: 3269 """ 3270 -mbb, -match-bounding-box: Match bounding box of one image to another 3271 3272 Syntax: `-mbb` 3273 3274 Given two images on the stack (reference and target), sets the header of the 3275 target image so that the two images occupy the same physical space. The 3276 direction cosines of the target image are set to match the reference image. 3277 This command is related to '-copy-transform' but supports images of 3278 different size. 3279 3280 c3d reference.nii target.nii -mbb -o out.nii. 3281 """ 3282 match_bounding_box: str 3283 """-mbb, -match-bounding-box: Match bounding box of one image to another 3284 3285 Syntax: `-mbb` 3286 3287 Given two images on the stack (reference and target), sets the header of the 3288 target image so that the two images occupy the same physical space. The 3289 direction cosines of the target image are set to match the reference image. 3290 This command is related to '-copy-transform' but supports images of 3291 different size. 3292 3293 c3d reference.nii target.nii -mbb -o out.nii""" 3294 3295 def run( 3296 self, 3297 execution: Execution, 3298 ) -> list[str]: 3299 """ 3300 Build command line arguments. This method is called by the main command. 3301 3302 Args: 3303 execution: The execution object. 3304 Returns: 3305 Command line arguments 3306 """ 3307 cargs = [] 3308 cargs.extend([ 3309 "-match-bounding-box", 3310 self.match_bounding_box 3311 ]) 3312 return cargs
-mbb, -match-bounding-box: Match bounding box of one image to another
Syntax: -mbb
Given two images on the stack (reference and target), sets the header of the target image so that the two images occupy the same physical space. The direction cosines of the target image are set to match the reference image. This command is related to '-copy-transform' but supports images of different size.
c3d reference.nii target.nii -mbb -o out.nii.
-mbb, -match-bounding-box: Match bounding box of one image to another
Syntax: -mbb
Given two images on the stack (reference and target), sets the header of the target image so that the two images occupy the same physical space. The direction cosines of the target image are set to match the reference image. This command is related to '-copy-transform' but supports images of different size.
c3d reference.nii target.nii -mbb -o out.nii
3295 def run( 3296 self, 3297 execution: Execution, 3298 ) -> list[str]: 3299 """ 3300 Build command line arguments. This method is called by the main command. 3301 3302 Args: 3303 execution: The execution object. 3304 Returns: 3305 Command line arguments 3306 """ 3307 cargs = [] 3308 cargs.extend([ 3309 "-match-bounding-box", 3310 self.match_bounding_box 3311 ]) 3312 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3739@dataclasses.dataclass 3740class C3dMattesMutualInfo: 3741 """ 3742 No description found. 3743 """ 3744 mattes_mutual_info: str 3745 """No description found.""" 3746 3747 def run( 3748 self, 3749 execution: Execution, 3750 ) -> list[str]: 3751 """ 3752 Build command line arguments. This method is called by the main command. 3753 3754 Args: 3755 execution: The execution object. 3756 Returns: 3757 Command line arguments 3758 """ 3759 cargs = [] 3760 cargs.extend([ 3761 "-mmi", 3762 self.mattes_mutual_info 3763 ]) 3764 return cargs
No description found.
3747 def run( 3748 self, 3749 execution: Execution, 3750 ) -> list[str]: 3751 """ 3752 Build command line arguments. This method is called by the main command. 3753 3754 Args: 3755 execution: The execution object. 3756 Returns: 3757 Command line arguments 3758 """ 3759 cargs = [] 3760 cargs.extend([ 3761 "-mmi", 3762 self.mattes_mutual_info 3763 ]) 3764 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3315@dataclasses.dataclass 3316class C3dMaximum: 3317 """ 3318 -max: Voxel-wise maximum of two images 3319 3320 Syntax: `-max` 3321 3322 Computes the voxel-wise maximum of two images. Can be used with the 3323 **-accum** command to compute maximum of all images. 3324 3325 c3d i1.nii i2.nii -max -o max12.nii 3326 c3d i1.nii i2.nii i3.nii i4.nii -accum -max -endaccum -o max1234.nii. 3327 """ 3328 maximum: str 3329 """-max: Voxel-wise maximum of two images 3330 3331 Syntax: `-max` 3332 3333 Computes the voxel-wise maximum of two images. Can be used with the 3334 **-accum** command to compute maximum of all images. 3335 3336 c3d i1.nii i2.nii -max -o max12.nii 3337 c3d i1.nii i2.nii i3.nii i4.nii -accum -max -endaccum -o max1234.nii""" 3338 3339 def run( 3340 self, 3341 execution: Execution, 3342 ) -> list[str]: 3343 """ 3344 Build command line arguments. This method is called by the main command. 3345 3346 Args: 3347 execution: The execution object. 3348 Returns: 3349 Command line arguments 3350 """ 3351 cargs = [] 3352 cargs.extend([ 3353 "-maximum", 3354 self.maximum 3355 ]) 3356 return cargs
-max: Voxel-wise maximum of two images
Syntax: -max
Computes the voxel-wise maximum of two images. Can be used with the -accum command to compute maximum of all images.
c3d i1.nii i2.nii -max -o max12.nii c3d i1.nii i2.nii i3.nii i4.nii -accum -max -endaccum -o max1234.nii.
-max: Voxel-wise maximum of two images
Syntax: -max
Computes the voxel-wise maximum of two images. Can be used with the -accum command to compute maximum of all images.
c3d i1.nii i2.nii -max -o max12.nii c3d i1.nii i2.nii i3.nii i4.nii -accum -max -endaccum -o max1234.nii
3339 def run( 3340 self, 3341 execution: Execution, 3342 ) -> list[str]: 3343 """ 3344 Build command line arguments. This method is called by the main command. 3345 3346 Args: 3347 execution: The execution object. 3348 Returns: 3349 Command line arguments 3350 """ 3351 cargs = [] 3352 cargs.extend([ 3353 "-maximum", 3354 self.maximum 3355 ]) 3356 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3421@dataclasses.dataclass 3422class C3dMean: 3423 """ 3424 -mean: Mean of all images on the stack 3425 3426 Syntax: `-mean ` 3427 3428 Computes the mean of all the images on the stack. All images on the stack 3429 are replaced with the mean image. 3430 3431 c3d image_*.nii -mean -o mean.nii. 3432 """ 3433 mean: str 3434 """-mean: Mean of all images on the stack 3435 3436 Syntax: `-mean ` 3437 3438 Computes the mean of all the images on the stack. All images on the stack 3439 are replaced with the mean image. 3440 3441 c3d image_*.nii -mean -o mean.nii""" 3442 3443 def run( 3444 self, 3445 execution: Execution, 3446 ) -> list[str]: 3447 """ 3448 Build command line arguments. This method is called by the main command. 3449 3450 Args: 3451 execution: The execution object. 3452 Returns: 3453 Command line arguments 3454 """ 3455 cargs = [] 3456 cargs.extend([ 3457 "-mean", 3458 self.mean 3459 ]) 3460 return cargs
-mean: Mean of all images on the stack
Syntax: -mean
Computes the mean of all the images on the stack. All images on the stack are replaced with the mean image.
c3d image_*.nii -mean -o mean.nii.
-mean: Mean of all images on the stack
Syntax: -mean
Computes the mean of all the images on the stack. All images on the stack are replaced with the mean image.
c3d image_*.nii -mean -o mean.nii
3443 def run( 3444 self, 3445 execution: Execution, 3446 ) -> list[str]: 3447 """ 3448 Build command line arguments. This method is called by the main command. 3449 3450 Args: 3451 execution: The execution object. 3452 Returns: 3453 Command line arguments 3454 """ 3455 cargs = [] 3456 cargs.extend([ 3457 "-mean", 3458 self.mean 3459 ]) 3460 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3549@dataclasses.dataclass 3550class C3dMeanFilter: 3551 """ 3552 -mf, -mean-filter: Mean filter 3553 3554 Syntax: `-mf <radius_vector>` 3555 3556 Applies the mean filter: the intensity of each voxel is replaced by the mean 3557 of the intensities in the neighborhood of size specified by the radius 3558 parameter. For example, the following code will apply the mean filter with 3559 the 5x5x5 neighborhood. 3560 3561 c3d in.nii -mf 2x2x2 -o filtered.nii. 3562 """ 3563 mean_filter: str 3564 """-mf, -mean-filter: Mean filter 3565 3566 Syntax: `-mf <radius_vector>` 3567 3568 Applies the mean filter: the intensity of each voxel is replaced by the mean 3569 of the intensities in the neighborhood of size specified by the radius 3570 parameter. For example, the following code will apply the mean filter with 3571 the 5x5x5 neighborhood. 3572 3573 c3d in.nii -mf 2x2x2 -o filtered.nii""" 3574 3575 def run( 3576 self, 3577 execution: Execution, 3578 ) -> list[str]: 3579 """ 3580 Build command line arguments. This method is called by the main command. 3581 3582 Args: 3583 execution: The execution object. 3584 Returns: 3585 Command line arguments 3586 """ 3587 cargs = [] 3588 cargs.extend([ 3589 "-mf", 3590 self.mean_filter 3591 ]) 3592 return cargs
-mf, -mean-filter: Mean filter
Syntax: -mf <radius_vector>
Applies the mean filter: the intensity of each voxel is replaced by the mean of the intensities in the neighborhood of size specified by the radius parameter. For example, the following code will apply the mean filter with the 5x5x5 neighborhood.
c3d in.nii -mf 2x2x2 -o filtered.nii.
-mf, -mean-filter: Mean filter
Syntax: -mf <radius_vector>
Applies the mean filter: the intensity of each voxel is replaced by the mean of the intensities in the neighborhood of size specified by the radius parameter. For example, the following code will apply the mean filter with the 5x5x5 neighborhood.
c3d in.nii -mf 2x2x2 -o filtered.nii
3575 def run( 3576 self, 3577 execution: Execution, 3578 ) -> list[str]: 3579 """ 3580 Build command line arguments. This method is called by the main command. 3581 3582 Args: 3583 execution: The execution object. 3584 Returns: 3585 Command line arguments 3586 """ 3587 cargs = [] 3588 cargs.extend([ 3589 "-mf", 3590 self.mean_filter 3591 ]) 3592 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3767@dataclasses.dataclass 3768class C3dMeanSquare: 3769 """ 3770 -msq, -mean-square: Compute mean square difference metric 3771 3772 Syntax: `-msq [movtransform.mat] [reftransform.mat]` 3773 3774 Compute the mean square difference metric between the last two images on the 3775 stack. If an optional *movtransform.mat* file is provided, the metric is 3776 computed by applying the transform to the moving image. If, in addition to 3777 *movtransform.mat*, the optional *reftransform.mat* file is also provided -- 3778 the moving transform is applied to the moving image, the ref transform is 3779 applied to the reference image, and the metric is computed in an image space 3780 that is physically halfway between the reference and moving images. This may 3781 be useful for unbiased metric computation if the two transforms are inverse 3782 of each other as both images undergo similar amount of interpolation. The 3783 definitions of reference and moving images and the transform file format are 3784 similar to the **-reslice-matrix** command. 3785 3786 # Compute metric between ref.nii and mov.nii 3787 c3d ref.nii mov.nii -msq 3788 3789 # Compute metric between ref.nii and mov.nii after applying transform to 3790 mov.nii 3791 c3d ref.nii mov.nii -msq tmov.mat 3792 3793 # Compute metric between ref.nii and mov.nii in a neutral space after 3794 applying transforms to both 3795 c3d ref.nii mov.nii -msq tmov.mat tref.mat. 3796 """ 3797 mean_square: str 3798 """-msq, -mean-square: Compute mean square difference metric 3799 3800 Syntax: `-msq [movtransform.mat] [reftransform.mat]` 3801 3802 Compute the mean square difference metric between the last two images on the 3803 stack. If an optional *movtransform.mat* file is provided, the metric is 3804 computed by applying the transform to the moving image. If, in addition to 3805 *movtransform.mat*, the optional *reftransform.mat* file is also provided -- 3806 the moving transform is applied to the moving image, the ref transform is 3807 applied to the reference image, and the metric is computed in an image space 3808 that is physically halfway between the reference and moving images. This may 3809 be useful for unbiased metric computation if the two transforms are inverse 3810 of each other as both images undergo similar amount of interpolation. The 3811 definitions of reference and moving images and the transform file format are 3812 similar to the **-reslice-matrix** command. 3813 3814 # Compute metric between ref.nii and mov.nii 3815 c3d ref.nii mov.nii -msq 3816 3817 # Compute metric between ref.nii and mov.nii after applying transform to 3818 mov.nii 3819 c3d ref.nii mov.nii -msq tmov.mat 3820 3821 # Compute metric between ref.nii and mov.nii in a neutral space after 3822 applying transforms to both 3823 c3d ref.nii mov.nii -msq tmov.mat tref.mat""" 3824 3825 def run( 3826 self, 3827 execution: Execution, 3828 ) -> list[str]: 3829 """ 3830 Build command line arguments. This method is called by the main command. 3831 3832 Args: 3833 execution: The execution object. 3834 Returns: 3835 Command line arguments 3836 """ 3837 cargs = [] 3838 cargs.extend([ 3839 "-msq", 3840 self.mean_square 3841 ]) 3842 return cargs
-msq, -mean-square: Compute mean square difference metric
Syntax: -msq [movtransform.mat] [reftransform.mat]
Compute the mean square difference metric between the last two images on the stack. If an optional movtransform.mat file is provided, the metric is computed by applying the transform to the moving image. If, in addition to movtransform.mat, the optional reftransform.mat file is also provided -- the moving transform is applied to the moving image, the ref transform is applied to the reference image, and the metric is computed in an image space that is physically halfway between the reference and moving images. This may be useful for unbiased metric computation if the two transforms are inverse of each other as both images undergo similar amount of interpolation. The definitions of reference and moving images and the transform file format are similar to the -reslice-matrix command.
Compute metric between ref.nii and mov.nii
c3d ref.nii mov.nii -msq
Compute metric between ref.nii and mov.nii after applying transform to
mov.nii c3d ref.nii mov.nii -msq tmov.mat
Compute metric between ref.nii and mov.nii in a neutral space after
applying transforms to both c3d ref.nii mov.nii -msq tmov.mat tref.mat.
-msq, -mean-square: Compute mean square difference metric
Syntax: -msq [movtransform.mat] [reftransform.mat]
Compute the mean square difference metric between the last two images on the stack. If an optional movtransform.mat file is provided, the metric is computed by applying the transform to the moving image. If, in addition to movtransform.mat, the optional reftransform.mat file is also provided -- the moving transform is applied to the moving image, the ref transform is applied to the reference image, and the metric is computed in an image space that is physically halfway between the reference and moving images. This may be useful for unbiased metric computation if the two transforms are inverse of each other as both images undergo similar amount of interpolation. The definitions of reference and moving images and the transform file format are similar to the -reslice-matrix command.
Compute metric between ref.nii and mov.nii
c3d ref.nii mov.nii -msq
Compute metric between ref.nii and mov.nii after applying transform to
mov.nii c3d ref.nii mov.nii -msq tmov.mat
Compute metric between ref.nii and mov.nii in a neutral space after
applying transforms to both c3d ref.nii mov.nii -msq tmov.mat tref.mat
3825 def run( 3826 self, 3827 execution: Execution, 3828 ) -> list[str]: 3829 """ 3830 Build command line arguments. This method is called by the main command. 3831 3832 Args: 3833 execution: The execution object. 3834 Returns: 3835 Command line arguments 3836 """ 3837 cargs = [] 3838 cargs.extend([ 3839 "-msq", 3840 self.mean_square 3841 ]) 3842 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3463@dataclasses.dataclass 3464class C3dMedianFilter: 3465 """ 3466 -median, -median-filter: Median filter 3467 3468 Syntax: `-median <radius_vector>` 3469 3470 Applies the median filter: the intensity of each voxel is replaced by the 3471 median of the intensities in the neighborhood of size specified by the 3472 radius parameter. For example, the following code will apply the median 3473 filter with the 5x5x5 neighborhood. 3474 3475 c3d in.nii -median 2x2x2 -o median.nii. 3476 """ 3477 median_filter: str 3478 """-median, -median-filter: Median filter 3479 3480 Syntax: `-median <radius_vector>` 3481 3482 Applies the median filter: the intensity of each voxel is replaced by the 3483 median of the intensities in the neighborhood of size specified by the 3484 radius parameter. For example, the following code will apply the median 3485 filter with the 5x5x5 neighborhood. 3486 3487 c3d in.nii -median 2x2x2 -o median.nii""" 3488 3489 def run( 3490 self, 3491 execution: Execution, 3492 ) -> list[str]: 3493 """ 3494 Build command line arguments. This method is called by the main command. 3495 3496 Args: 3497 execution: The execution object. 3498 Returns: 3499 Command line arguments 3500 """ 3501 cargs = [] 3502 cargs.extend([ 3503 "-median", 3504 self.median_filter 3505 ]) 3506 return cargs
-median, -median-filter: Median filter
Syntax: -median <radius_vector>
Applies the median filter: the intensity of each voxel is replaced by the median of the intensities in the neighborhood of size specified by the radius parameter. For example, the following code will apply the median filter with the 5x5x5 neighborhood.
c3d in.nii -median 2x2x2 -o median.nii.
-median, -median-filter: Median filter
Syntax: -median <radius_vector>
Applies the median filter: the intensity of each voxel is replaced by the median of the intensities in the neighborhood of size specified by the radius parameter. For example, the following code will apply the median filter with the 5x5x5 neighborhood.
c3d in.nii -median 2x2x2 -o median.nii
3489 def run( 3490 self, 3491 execution: Execution, 3492 ) -> list[str]: 3493 """ 3494 Build command line arguments. This method is called by the main command. 3495 3496 Args: 3497 execution: The execution object. 3498 Returns: 3499 Command line arguments 3500 """ 3501 cargs = [] 3502 cargs.extend([ 3503 "-median", 3504 self.median_filter 3505 ]) 3506 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3509@dataclasses.dataclass 3510class C3dMerge: 3511 """ 3512 -merge: Merge images from previous split command 3513 3514 Syntax: `-merge` 3515 3516 Works in conjunction with the **-split** command. Has similar behavior to 3517 **-vote**, except that label values are carried from the input to the 3518 **-split** command. 3519 """ 3520 merge: str 3521 """-merge: Merge images from previous split command 3522 3523 Syntax: `-merge` 3524 3525 Works in conjunction with the **-split** command. Has similar behavior to 3526 **-vote**, except that label values are carried from the input to the 3527 **-split** command.""" 3528 3529 def run( 3530 self, 3531 execution: Execution, 3532 ) -> list[str]: 3533 """ 3534 Build command line arguments. This method is called by the main command. 3535 3536 Args: 3537 execution: The execution object. 3538 Returns: 3539 Command line arguments 3540 """ 3541 cargs = [] 3542 cargs.extend([ 3543 "-merge", 3544 self.merge 3545 ]) 3546 return cargs
-merge: Merge images from previous split command
Syntax: -merge
Works in conjunction with the -split command. Has similar behavior to -vote, except that label values are carried from the input to the -split command.
-merge: Merge images from previous split command
Syntax: -merge
Works in conjunction with the -split command. Has similar behavior to -vote, except that label values are carried from the input to the -split command.
3529 def run( 3530 self, 3531 execution: Execution, 3532 ) -> list[str]: 3533 """ 3534 Build command line arguments. This method is called by the main command. 3535 3536 Args: 3537 execution: The execution object. 3538 Returns: 3539 Command line arguments 3540 """ 3541 cargs = [] 3542 cargs.extend([ 3543 "-merge", 3544 self.merge 3545 ]) 3546 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3639@dataclasses.dataclass 3640class C3dMinimum: 3641 """ 3642 -min: Voxel-wise minimum of two images 3643 3644 Syntax: `-min` 3645 3646 Computes the voxel-wise minimum of two images. Can be used with the 3647 **-accum** command to compute minimum of all images. 3648 3649 c3d i1.nii i2.nii -min -o min12.nii 3650 c3d i1.nii i2.nii i3.nii i4.nii -accum -min -endaccum -o min1234.nii. 3651 """ 3652 minimum: str 3653 """-min: Voxel-wise minimum of two images 3654 3655 Syntax: `-min` 3656 3657 Computes the voxel-wise minimum of two images. Can be used with the 3658 **-accum** command to compute minimum of all images. 3659 3660 c3d i1.nii i2.nii -min -o min12.nii 3661 c3d i1.nii i2.nii i3.nii i4.nii -accum -min -endaccum -o min1234.nii""" 3662 3663 def run( 3664 self, 3665 execution: Execution, 3666 ) -> list[str]: 3667 """ 3668 Build command line arguments. This method is called by the main command. 3669 3670 Args: 3671 execution: The execution object. 3672 Returns: 3673 Command line arguments 3674 """ 3675 cargs = [] 3676 cargs.extend([ 3677 "-minimum", 3678 self.minimum 3679 ]) 3680 return cargs
-min: Voxel-wise minimum of two images
Syntax: -min
Computes the voxel-wise minimum of two images. Can be used with the -accum command to compute minimum of all images.
c3d i1.nii i2.nii -min -o min12.nii c3d i1.nii i2.nii i3.nii i4.nii -accum -min -endaccum -o min1234.nii.
-min: Voxel-wise minimum of two images
Syntax: -min
Computes the voxel-wise minimum of two images. Can be used with the -accum command to compute minimum of all images.
c3d i1.nii i2.nii -min -o min12.nii c3d i1.nii i2.nii i3.nii i4.nii -accum -min -endaccum -o min1234.nii
3663 def run( 3664 self, 3665 execution: Execution, 3666 ) -> list[str]: 3667 """ 3668 Build command line arguments. This method is called by the main command. 3669 3670 Args: 3671 execution: The execution object. 3672 Returns: 3673 Command line arguments 3674 """ 3675 cargs = [] 3676 cargs.extend([ 3677 "-minimum", 3678 self.minimum 3679 ]) 3680 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3683@dataclasses.dataclass 3684class C3dMixtureModel: 3685 """ 3686 No description found. 3687 """ 3688 mixture_model: str 3689 """No description found.""" 3690 3691 def run( 3692 self, 3693 execution: Execution, 3694 ) -> list[str]: 3695 """ 3696 Build command line arguments. This method is called by the main command. 3697 3698 Args: 3699 execution: The execution object. 3700 Returns: 3701 Command line arguments 3702 """ 3703 cargs = [] 3704 cargs.extend([ 3705 "-mixture", 3706 self.mixture_model 3707 ]) 3708 return cargs
No description found.
3691 def run( 3692 self, 3693 execution: Execution, 3694 ) -> list[str]: 3695 """ 3696 Build command line arguments. This method is called by the main command. 3697 3698 Args: 3699 execution: The execution object. 3700 Returns: 3701 Command line arguments 3702 """ 3703 cargs = [] 3704 cargs.extend([ 3705 "-mixture", 3706 self.mixture_model 3707 ]) 3708 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3711@dataclasses.dataclass 3712class C3dMoments: 3713 """ 3714 No description found. 3715 """ 3716 moments: str 3717 """No description found.""" 3718 3719 def run( 3720 self, 3721 execution: Execution, 3722 ) -> list[str]: 3723 """ 3724 Build command line arguments. This method is called by the main command. 3725 3726 Args: 3727 execution: The execution object. 3728 Returns: 3729 Command line arguments 3730 """ 3731 cargs = [] 3732 cargs.extend([ 3733 "-moments", 3734 self.moments 3735 ]) 3736 return cargs
No description found.
3719 def run( 3720 self, 3721 execution: Execution, 3722 ) -> list[str]: 3723 """ 3724 Build command line arguments. This method is called by the main command. 3725 3726 Args: 3727 execution: The execution object. 3728 Returns: 3729 Command line arguments 3730 """ 3731 cargs = [] 3732 cargs.extend([ 3733 "-moments", 3734 self.moments 3735 ]) 3736 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3359@dataclasses.dataclass 3360class C3dMulticomponentSplit: 3361 """ 3362 -mcs, -multicomponent-split: Enable splitting of multi-component images on 3363 read 3364 3365 Syntax: `-mcs` 3366 3367 Enable reading of multi-component images. By default, when a multi-component 3368 image is encountered, the components are combined into a single image. 3369 Setting the **-mcs** flag changes this behavior, and each of the components 3370 is loaded sequentially. See the section below on multi-component image 3371 support. 3372 3373 $ c3d -mcs rgb.mha -foreach -probe 110x110x80mm -endfor 3374 Interpolated image value at 110 110 80 is 1 3375 Interpolated image value at 110 110 80 is 66 3376 Interpolated image value at 110 110 80 is 29 3377 3378 $ c3d rgb.mha -foreach -probe 110x110x80mm -endfor 3379 Interpolated image value at 110 110 80 is 49.5198. 3380 """ 3381 multicomponent_split: str 3382 """-mcs, -multicomponent-split: Enable splitting of multi-component images 3383 on read 3384 3385 Syntax: `-mcs` 3386 3387 Enable reading of multi-component images. By default, when a multi-component 3388 image is encountered, the components are combined into a single image. 3389 Setting the **-mcs** flag changes this behavior, and each of the components 3390 is loaded sequentially. See the section below on multi-component image 3391 support. 3392 3393 $ c3d -mcs rgb.mha -foreach -probe 110x110x80mm -endfor 3394 Interpolated image value at 110 110 80 is 1 3395 Interpolated image value at 110 110 80 is 66 3396 Interpolated image value at 110 110 80 is 29 3397 3398 $ c3d rgb.mha -foreach -probe 110x110x80mm -endfor 3399 Interpolated image value at 110 110 80 is 49.5198""" 3400 3401 def run( 3402 self, 3403 execution: Execution, 3404 ) -> list[str]: 3405 """ 3406 Build command line arguments. This method is called by the main command. 3407 3408 Args: 3409 execution: The execution object. 3410 Returns: 3411 Command line arguments 3412 """ 3413 cargs = [] 3414 cargs.extend([ 3415 "-mcs", 3416 self.multicomponent_split 3417 ]) 3418 return cargs
-mcs, -multicomponent-split: Enable splitting of multi-component images on read
Syntax: -mcs
Enable reading of multi-component images. By default, when a multi-component image is encountered, the components are combined into a single image. Setting the -mcs flag changes this behavior, and each of the components is loaded sequentially. See the section below on multi-component image support.
$ c3d -mcs rgb.mha -foreach -probe 110x110x80mm -endfor Interpolated image value at 110 110 80 is 1 Interpolated image value at 110 110 80 is 66 Interpolated image value at 110 110 80 is 29
$ c3d rgb.mha -foreach -probe 110x110x80mm -endfor Interpolated image value at 110 110 80 is 49.5198.
-mcs, -multicomponent-split: Enable splitting of multi-component images on read
Syntax: -mcs
Enable reading of multi-component images. By default, when a multi-component image is encountered, the components are combined into a single image. Setting the -mcs flag changes this behavior, and each of the components is loaded sequentially. See the section below on multi-component image support.
$ c3d -mcs rgb.mha -foreach -probe 110x110x80mm -endfor Interpolated image value at 110 110 80 is 1 Interpolated image value at 110 110 80 is 66 Interpolated image value at 110 110 80 is 29
$ c3d rgb.mha -foreach -probe 110x110x80mm -endfor Interpolated image value at 110 110 80 is 49.5198
3401 def run( 3402 self, 3403 execution: Execution, 3404 ) -> list[str]: 3405 """ 3406 Build command line arguments. This method is called by the main command. 3407 3408 Args: 3409 execution: The execution object. 3410 Returns: 3411 Command line arguments 3412 """ 3413 cargs = [] 3414 cargs.extend([ 3415 "-mcs", 3416 self.multicomponent_split 3417 ]) 3418 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3845@dataclasses.dataclass 3846class C3dMultiply: 3847 """ 3848 -multiply, -times: Multiply two images 3849 3850 Syntax: `-multiply` 3851 3852 Multiply two images voxel-by-voxel. The operation is applied to the last two 3853 images on the stack. 3854 3855 # Compute x = a * b 3856 c3d a.img b.img -multiply -o x.img 3857 3858 # Compute x = a * (b + c) using add and -multiply 3859 c3d a.img b.img c.img -multiply -add -o x.img 3860 3861 Combine with the **-dup** command to compute voxelwise square of the image 3862 3863 # Compute x = a^2 3864 c3d a.img -dup -multiply -o x.img. 3865 """ 3866 multiply: str 3867 """-multiply, -times: Multiply two images 3868 3869 Syntax: `-multiply` 3870 3871 Multiply two images voxel-by-voxel. The operation is applied to the last two 3872 images on the stack. 3873 3874 # Compute x = a * b 3875 c3d a.img b.img -multiply -o x.img 3876 3877 # Compute x = a * (b + c) using add and -multiply 3878 c3d a.img b.img c.img -multiply -add -o x.img 3879 3880 Combine with the **-dup** command to compute voxelwise square of the image 3881 3882 # Compute x = a^2 3883 c3d a.img -dup -multiply -o x.img""" 3884 3885 def run( 3886 self, 3887 execution: Execution, 3888 ) -> list[str]: 3889 """ 3890 Build command line arguments. This method is called by the main command. 3891 3892 Args: 3893 execution: The execution object. 3894 Returns: 3895 Command line arguments 3896 """ 3897 cargs = [] 3898 cargs.extend([ 3899 "-multiply", 3900 self.multiply 3901 ]) 3902 return cargs
-multiply, -times: Multiply two images
Syntax: -multiply
Multiply two images voxel-by-voxel. The operation is applied to the last two images on the stack.
Compute x = a * b
c3d a.img b.img -multiply -o x.img
Compute x = a * (b + c) using add and -multiply
c3d a.img b.img c.img -multiply -add -o x.img
Combine with the -dup command to compute voxelwise square of the image
Compute x = a^2
c3d a.img -dup -multiply -o x.img.
-multiply, -times: Multiply two images
Syntax: -multiply
Multiply two images voxel-by-voxel. The operation is applied to the last two images on the stack.
Compute x = a * b
c3d a.img b.img -multiply -o x.img
Compute x = a * (b + c) using add and -multiply
c3d a.img b.img c.img -multiply -add -o x.img
Combine with the -dup command to compute voxelwise square of the image
Compute x = a^2
c3d a.img -dup -multiply -o x.img
3885 def run( 3886 self, 3887 execution: Execution, 3888 ) -> list[str]: 3889 """ 3890 Build command line arguments. This method is called by the main command. 3891 3892 Args: 3893 execution: The execution object. 3894 Returns: 3895 Command line arguments 3896 """ 3897 cargs = [] 3898 cargs.extend([ 3899 "-multiply", 3900 self.multiply 3901 ]) 3902 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3595@dataclasses.dataclass 3596class C3dMutualInfo: 3597 """ 3598 -min: Voxel-wise minimum of two images 3599 3600 Syntax: `-min` 3601 3602 Computes the voxel-wise minimum of two images. Can be used with the 3603 **-accum** command to compute minimum of all images. 3604 3605 c3d i1.nii i2.nii -min -o min12.nii 3606 c3d i1.nii i2.nii i3.nii i4.nii -accum -min -endaccum -o min1234.nii. 3607 """ 3608 mutual_info: str 3609 """-min: Voxel-wise minimum of two images 3610 3611 Syntax: `-min` 3612 3613 Computes the voxel-wise minimum of two images. Can be used with the 3614 **-accum** command to compute minimum of all images. 3615 3616 c3d i1.nii i2.nii -min -o min12.nii 3617 c3d i1.nii i2.nii i3.nii i4.nii -accum -min -endaccum -o min1234.nii""" 3618 3619 def run( 3620 self, 3621 execution: Execution, 3622 ) -> list[str]: 3623 """ 3624 Build command line arguments. This method is called by the main command. 3625 3626 Args: 3627 execution: The execution object. 3628 Returns: 3629 Command line arguments 3630 """ 3631 cargs = [] 3632 cargs.extend([ 3633 "-mi", 3634 self.mutual_info 3635 ]) 3636 return cargs
-min: Voxel-wise minimum of two images
Syntax: -min
Computes the voxel-wise minimum of two images. Can be used with the -accum command to compute minimum of all images.
c3d i1.nii i2.nii -min -o min12.nii c3d i1.nii i2.nii i3.nii i4.nii -accum -min -endaccum -o min1234.nii.
-min: Voxel-wise minimum of two images
Syntax: -min
Computes the voxel-wise minimum of two images. Can be used with the -accum command to compute minimum of all images.
c3d i1.nii i2.nii -min -o min12.nii c3d i1.nii i2.nii i3.nii i4.nii -accum -min -endaccum -o min1234.nii
3619 def run( 3620 self, 3621 execution: Execution, 3622 ) -> list[str]: 3623 """ 3624 Build command line arguments. This method is called by the main command. 3625 3626 Args: 3627 execution: The execution object. 3628 Returns: 3629 Command line arguments 3630 """ 3631 cargs = [] 3632 cargs.extend([ 3633 "-mi", 3634 self.mutual_info 3635 ]) 3636 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
466@dataclasses.dataclass 467class C3dN4BiasCorrection: 468 """ 469 -biascorr: Automatic MRI bias field correction 470 471 Syntax: `-biascorr` 472 473 Performs automatic bias field correction for MRI images. This feature uses 474 the [N3 implementation in ITK by Dr. Tustison][4], based on the N3 algorithm 475 by Sled et al. 476 477 c3d mri.nii.gz -biascorr -o mricorr.nii.gz. 478 """ 479 n4_bias_correction: str 480 """-biascorr: Automatic MRI bias field correction 481 482 Syntax: `-biascorr` 483 484 Performs automatic bias field correction for MRI images. This feature uses 485 the [N3 implementation in ITK by Dr. Tustison][4], based on the N3 algorithm 486 by Sled et al. 487 488 c3d mri.nii.gz -biascorr -o mricorr.nii.gz""" 489 490 def run( 491 self, 492 execution: Execution, 493 ) -> list[str]: 494 """ 495 Build command line arguments. This method is called by the main command. 496 497 Args: 498 execution: The execution object. 499 Returns: 500 Command line arguments 501 """ 502 cargs = [] 503 cargs.extend([ 504 "-biascorr", 505 self.n4_bias_correction 506 ]) 507 return cargs
-biascorr: Automatic MRI bias field correction
Syntax: -biascorr
Performs automatic bias field correction for MRI images. This feature uses the [N3 implementation in ITK by Dr. Tustison][4], based on the N3 algorithm by Sled et al.
c3d mri.nii.gz -biascorr -o mricorr.nii.gz.
-biascorr: Automatic MRI bias field correction
Syntax: -biascorr
Performs automatic bias field correction for MRI images. This feature uses the [N3 implementation in ITK by Dr. Tustison][4], based on the N3 algorithm by Sled et al.
c3d mri.nii.gz -biascorr -o mricorr.nii.gz
490 def run( 491 self, 492 execution: Execution, 493 ) -> list[str]: 494 """ 495 Build command line arguments. This method is called by the main command. 496 497 Args: 498 execution: The execution object. 499 Returns: 500 Command line arguments 501 """ 502 cargs = [] 503 cargs.extend([ 504 "-biascorr", 505 self.n4_bias_correction 506 ]) 507 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1008@dataclasses.dataclass 1009class C3dNoCompress: 1010 """ 1011 -compress, -no-compress: Enable/disable compression for some image files 1012 1013 Syntax: `-compress` or `-no-compress` 1014 1015 Turns on compressing for image file formats that support it. For some file 1016 formats, like NIFTI (.nii), compression is enabled automatically when the 1017 filename includes the **.gz** extension. For other formats, like MetaImage, 1018 you need to specify **-compress** to enable compression. The following two 1019 commands save the image as compressed NIFTI and MetaImage files: 1020 1021 c3d input.nii -o output.nii.gz 1022 c3d input.nii -compress -o output.mha. 1023 """ 1024 no_compress: str 1025 """-compress, -no-compress: Enable/disable compression for some image files 1026 1027 Syntax: `-compress` or `-no-compress` 1028 1029 Turns on compressing for image file formats that support it. For some file 1030 formats, like NIFTI (.nii), compression is enabled automatically when the 1031 filename includes the **.gz** extension. For other formats, like MetaImage, 1032 you need to specify **-compress** to enable compression. The following two 1033 commands save the image as compressed NIFTI and MetaImage files: 1034 1035 c3d input.nii -o output.nii.gz 1036 c3d input.nii -compress -o output.mha""" 1037 1038 def run( 1039 self, 1040 execution: Execution, 1041 ) -> list[str]: 1042 """ 1043 Build command line arguments. This method is called by the main command. 1044 1045 Args: 1046 execution: The execution object. 1047 Returns: 1048 Command line arguments 1049 """ 1050 cargs = [] 1051 cargs.extend([ 1052 "-no-compress", 1053 self.no_compress 1054 ]) 1055 return cargs
-compress, -no-compress: Enable/disable compression for some image files
Syntax: -compress or -no-compress
Turns on compressing for image file formats that support it. For some file formats, like NIFTI (.nii), compression is enabled automatically when the filename includes the .gz extension. For other formats, like MetaImage, you need to specify -compress to enable compression. The following two commands save the image as compressed NIFTI and MetaImage files:
c3d input.nii -o output.nii.gz c3d input.nii -compress -o output.mha.
-compress, -no-compress: Enable/disable compression for some image files
Syntax: -compress or -no-compress
Turns on compressing for image file formats that support it. For some file formats, like NIFTI (.nii), compression is enabled automatically when the filename includes the .gz extension. For other formats, like MetaImage, you need to specify -compress to enable compression. The following two commands save the image as compressed NIFTI and MetaImage files:
c3d input.nii -o output.nii.gz c3d input.nii -compress -o output.mha
1038 def run( 1039 self, 1040 execution: Execution, 1041 ) -> list[str]: 1042 """ 1043 Build command line arguments. This method is called by the main command. 1044 1045 Args: 1046 execution: The execution object. 1047 Returns: 1048 Command line arguments 1049 """ 1050 cargs = [] 1051 cargs.extend([ 1052 "-no-compress", 1053 self.no_compress 1054 ]) 1055 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4189@dataclasses.dataclass 4190class C3dNoMulticomponentSplit: 4191 """ 4192 -nomcs, -no-multicomponent-split: Disable splitting of multi-component 4193 images on read 4194 4195 Syntax: `-nomcs` 4196 4197 Used to reverse the effect of previous **-mcs** command. 4198 """ 4199 no_multicomponent_split: str 4200 """-nomcs, -no-multicomponent-split: Disable splitting of multi-component 4201 images on read 4202 4203 Syntax: `-nomcs` 4204 4205 Used to reverse the effect of previous **-mcs** command.""" 4206 4207 def run( 4208 self, 4209 execution: Execution, 4210 ) -> list[str]: 4211 """ 4212 Build command line arguments. This method is called by the main command. 4213 4214 Args: 4215 execution: The execution object. 4216 Returns: 4217 Command line arguments 4218 """ 4219 cargs = [] 4220 cargs.extend([ 4221 "-nomcs", 4222 self.no_multicomponent_split 4223 ]) 4224 return cargs
-nomcs, -no-multicomponent-split: Disable splitting of multi-component images on read
Syntax: -nomcs
Used to reverse the effect of previous -mcs command.
-nomcs, -no-multicomponent-split: Disable splitting of multi-component images on read
Syntax: -nomcs
Used to reverse the effect of previous -mcs command.
4207 def run( 4208 self, 4209 execution: Execution, 4210 ) -> list[str]: 4211 """ 4212 Build command line arguments. This method is called by the main command. 4213 4214 Args: 4215 execution: The execution object. 4216 Returns: 4217 Command line arguments 4218 """ 4219 cargs = [] 4220 cargs.extend([ 4221 "-nomcs", 4222 self.no_multicomponent_split 4223 ]) 4224 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4027@dataclasses.dataclass 4028class C3dNoiseGaussian: 4029 """ 4030 -noise-gaussian, -noise: Apply additive Gaussian noise 4031 4032 Syntax: `-noise-gaussian <sigma>` 4033 4034 Adds Gaussian noise to an image with zero mean and standard deviation sigma. 4035 Please see [Noise simulation article][15] by G. Lehmann for details. 4036 4037 c3d image.nii -noise-gaussian 5 -o noisy.nii. 4038 """ 4039 noise_gaussian: str 4040 """-noise-gaussian, -noise: Apply additive Gaussian noise 4041 4042 Syntax: `-noise-gaussian <sigma>` 4043 4044 Adds Gaussian noise to an image with zero mean and standard deviation sigma. 4045 Please see [Noise simulation article][15] by G. Lehmann for details. 4046 4047 c3d image.nii -noise-gaussian 5 -o noisy.nii""" 4048 4049 def run( 4050 self, 4051 execution: Execution, 4052 ) -> list[str]: 4053 """ 4054 Build command line arguments. This method is called by the main command. 4055 4056 Args: 4057 execution: The execution object. 4058 Returns: 4059 Command line arguments 4060 """ 4061 cargs = [] 4062 cargs.extend([ 4063 "-noise-gaussian", 4064 self.noise_gaussian 4065 ]) 4066 return cargs
-noise-gaussian, -noise: Apply additive Gaussian noise
Syntax: -noise-gaussian <sigma>
Adds Gaussian noise to an image with zero mean and standard deviation sigma. Please see [Noise simulation article][15] by G. Lehmann for details.
c3d image.nii -noise-gaussian 5 -o noisy.nii.
-noise-gaussian, -noise: Apply additive Gaussian noise
Syntax: -noise-gaussian <sigma>
Adds Gaussian noise to an image with zero mean and standard deviation sigma. Please see [Noise simulation article][15] by G. Lehmann for details.
c3d image.nii -noise-gaussian 5 -o noisy.nii
4049 def run( 4050 self, 4051 execution: Execution, 4052 ) -> list[str]: 4053 """ 4054 Build command line arguments. This method is called by the main command. 4055 4056 Args: 4057 execution: The execution object. 4058 Returns: 4059 Command line arguments 4060 """ 4061 cargs = [] 4062 cargs.extend([ 4063 "-noise-gaussian", 4064 self.noise_gaussian 4065 ]) 4066 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4069@dataclasses.dataclass 4070class C3dNoisePoisson: 4071 """ 4072 -noise-poisson: Apply Poisson noise 4073 Syntax: `-noise-poisson <scale>` 4074 4075 Applies Poisson (shot) noise to an image with given scale. Please see [Noise 4076 simulation article][15] by G. Lehmann for details. 4077 4078 c3d image.nii -noise-poisson 5 -o noisy.nii. 4079 """ 4080 noise_poisson: str 4081 """-noise-poisson: Apply Poisson noise 4082 Syntax: `-noise-poisson <scale>` 4083 4084 Applies Poisson (shot) noise to an image with given scale. Please see [Noise 4085 simulation article][15] by G. Lehmann for details. 4086 4087 c3d image.nii -noise-poisson 5 -o noisy.nii""" 4088 4089 def run( 4090 self, 4091 execution: Execution, 4092 ) -> list[str]: 4093 """ 4094 Build command line arguments. This method is called by the main command. 4095 4096 Args: 4097 execution: The execution object. 4098 Returns: 4099 Command line arguments 4100 """ 4101 cargs = [] 4102 cargs.extend([ 4103 "-noise-poisson", 4104 self.noise_poisson 4105 ]) 4106 return cargs
-noise-poisson: Apply Poisson noise
Syntax: -noise-poisson <scale>
Applies Poisson (shot) noise to an image with given scale. Please see [Noise simulation article][15] by G. Lehmann for details.
c3d image.nii -noise-poisson 5 -o noisy.nii.
-noise-poisson: Apply Poisson noise
Syntax: -noise-poisson <scale>
Applies Poisson (shot) noise to an image with given scale. Please see [Noise simulation article][15] by G. Lehmann for details.
c3d image.nii -noise-poisson 5 -o noisy.nii
4089 def run( 4090 self, 4091 execution: Execution, 4092 ) -> list[str]: 4093 """ 4094 Build command line arguments. This method is called by the main command. 4095 4096 Args: 4097 execution: The execution object. 4098 Returns: 4099 Command line arguments 4100 """ 4101 cargs = [] 4102 cargs.extend([ 4103 "-noise-poisson", 4104 self.noise_poisson 4105 ]) 4106 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4149@dataclasses.dataclass 4150class C3dNoiseSaltPepper: 4151 """ 4152 -noise-salt-pepper: Apply salt and pepper noise 4153 Syntax: `-noise-salt-pepper <probability>` 4154 4155 Applies salt and pepper noise to an image with given probability. Please see 4156 [Noise simulation article][15] by G. Lehmann for details. 4157 4158 c3d image.nii -noise-salt-pepper 0.1 -o noisy.nii. 4159 """ 4160 noise_salt_pepper: str 4161 """-noise-salt-pepper: Apply salt and pepper noise 4162 Syntax: `-noise-salt-pepper <probability>` 4163 4164 Applies salt and pepper noise to an image with given probability. Please see 4165 [Noise simulation article][15] by G. Lehmann for details. 4166 4167 c3d image.nii -noise-salt-pepper 0.1 -o noisy.nii""" 4168 4169 def run( 4170 self, 4171 execution: Execution, 4172 ) -> list[str]: 4173 """ 4174 Build command line arguments. This method is called by the main command. 4175 4176 Args: 4177 execution: The execution object. 4178 Returns: 4179 Command line arguments 4180 """ 4181 cargs = [] 4182 cargs.extend([ 4183 "-noise-salt-pepper", 4184 self.noise_salt_pepper 4185 ]) 4186 return cargs
-noise-salt-pepper: Apply salt and pepper noise
Syntax: -noise-salt-pepper <probability>
Applies salt and pepper noise to an image with given probability. Please see [Noise simulation article][15] by G. Lehmann for details.
c3d image.nii -noise-salt-pepper 0.1 -o noisy.nii.
-noise-salt-pepper: Apply salt and pepper noise
Syntax: -noise-salt-pepper <probability>
Applies salt and pepper noise to an image with given probability. Please see [Noise simulation article][15] by G. Lehmann for details.
c3d image.nii -noise-salt-pepper 0.1 -o noisy.nii
4169 def run( 4170 self, 4171 execution: Execution, 4172 ) -> list[str]: 4173 """ 4174 Build command line arguments. This method is called by the main command. 4175 4176 Args: 4177 execution: The execution object. 4178 Returns: 4179 Command line arguments 4180 """ 4181 cargs = [] 4182 cargs.extend([ 4183 "-noise-salt-pepper", 4184 self.noise_salt_pepper 4185 ]) 4186 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4109@dataclasses.dataclass 4110class C3dNoiseSpeckle: 4111 """ 4112 -noise-speckle: Apply Poisson noise 4113 Syntax: `-noise-speckle <sigma>` 4114 4115 Applies Speckle noise to an image with given standard deviation. Please see 4116 [Noise simulation article][15] by G. Lehmann for details. 4117 4118 c3d image.nii -noise-speckle 5 -o noisy.nii. 4119 """ 4120 noise_speckle: str 4121 """-noise-speckle: Apply Poisson noise 4122 Syntax: `-noise-speckle <sigma>` 4123 4124 Applies Speckle noise to an image with given standard deviation. Please see 4125 [Noise simulation article][15] by G. Lehmann for details. 4126 4127 c3d image.nii -noise-speckle 5 -o noisy.nii""" 4128 4129 def run( 4130 self, 4131 execution: Execution, 4132 ) -> list[str]: 4133 """ 4134 Build command line arguments. This method is called by the main command. 4135 4136 Args: 4137 execution: The execution object. 4138 Returns: 4139 Command line arguments 4140 """ 4141 cargs = [] 4142 cargs.extend([ 4143 "-noise-speckle", 4144 self.noise_speckle 4145 ]) 4146 return cargs
-noise-speckle: Apply Poisson noise
Syntax: -noise-speckle <sigma>
Applies Speckle noise to an image with given standard deviation. Please see [Noise simulation article][15] by G. Lehmann for details.
c3d image.nii -noise-speckle 5 -o noisy.nii.
-noise-speckle: Apply Poisson noise
Syntax: -noise-speckle <sigma>
Applies Speckle noise to an image with given standard deviation. Please see [Noise simulation article][15] by G. Lehmann for details.
c3d image.nii -noise-speckle 5 -o noisy.nii
4129 def run( 4130 self, 4131 execution: Execution, 4132 ) -> list[str]: 4133 """ 4134 Build command line arguments. This method is called by the main command. 4135 4136 Args: 4137 execution: The execution object. 4138 Returns: 4139 Command line arguments 4140 """ 4141 cargs = [] 4142 cargs.extend([ 4143 "-noise-speckle", 4144 self.noise_speckle 4145 ]) 4146 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4227@dataclasses.dataclass 4228class C3dNormalizeLocalWindow: 4229 """ 4230 -nlw, -normalize-local-window: Standardize image intensity using local 4231 neighborhood 4232 4233 Syntax: `-nlw <radius>` 4234 4235 This command takes as inputs an image and a mask image. At each voxel, the 4236 mean of the local neighborhood is subtracted, and the result is divided by 4237 the standard deviation of the neighborhood. The mean and standard deviation 4238 are computed only over the masked region. You might also want to multiply by 4239 the mask. 4240 4241 c3d gray.nii.gz mask.nii.gz -nlw 10x10x10 -o residual.nii.gz. 4242 """ 4243 normalize_local_window: str 4244 """-nlw, -normalize-local-window: Standardize image intensity using local 4245 neighborhood 4246 4247 Syntax: `-nlw <radius>` 4248 4249 This command takes as inputs an image and a mask image. At each voxel, the 4250 mean of the local neighborhood is subtracted, and the result is divided by 4251 the standard deviation of the neighborhood. The mean and standard deviation 4252 are computed only over the masked region. You might also want to multiply by 4253 the mask. 4254 4255 c3d gray.nii.gz mask.nii.gz -nlw 10x10x10 -o residual.nii.gz""" 4256 4257 def run( 4258 self, 4259 execution: Execution, 4260 ) -> list[str]: 4261 """ 4262 Build command line arguments. This method is called by the main command. 4263 4264 Args: 4265 execution: The execution object. 4266 Returns: 4267 Command line arguments 4268 """ 4269 cargs = [] 4270 cargs.extend([ 4271 "-nlw", 4272 self.normalize_local_window 4273 ]) 4274 return cargs
-nlw, -normalize-local-window: Standardize image intensity using local neighborhood
Syntax: -nlw <radius>
This command takes as inputs an image and a mask image. At each voxel, the mean of the local neighborhood is subtracted, and the result is divided by the standard deviation of the neighborhood. The mean and standard deviation are computed only over the masked region. You might also want to multiply by the mask.
c3d gray.nii.gz mask.nii.gz -nlw 10x10x10 -o residual.nii.gz.
-nlw, -normalize-local-window: Standardize image intensity using local neighborhood
Syntax: -nlw <radius>
This command takes as inputs an image and a mask image. At each voxel, the mean of the local neighborhood is subtracted, and the result is divided by the standard deviation of the neighborhood. The mean and standard deviation are computed only over the masked region. You might also want to multiply by the mask.
c3d gray.nii.gz mask.nii.gz -nlw 10x10x10 -o residual.nii.gz
4257 def run( 4258 self, 4259 execution: Execution, 4260 ) -> list[str]: 4261 """ 4262 Build command line arguments. This method is called by the main command. 4263 4264 Args: 4265 execution: The execution object. 4266 Returns: 4267 Command line arguments 4268 """ 4269 cargs = [] 4270 cargs.extend([ 4271 "-nlw", 4272 self.normalize_local_window 4273 ]) 4274 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3951@dataclasses.dataclass 3952class C3dNormalizedCorrelation: 3953 """ 3954 -ncor, -normalized-correlation: Compute normalized correlation metric 3955 3956 Syntax: `-ncor [movtransform.mat] [reftransform.mat]` 3957 3958 : Compute the normalized correlation metric between the last two images on 3959 the stack. See documentation for **-msq***. 3960 """ 3961 normalized_correlation: str 3962 """-ncor, -normalized-correlation: Compute normalized correlation metric 3963 3964 Syntax: `-ncor [movtransform.mat] [reftransform.mat]` 3965 3966 : Compute the normalized correlation metric between the last two images on 3967 the stack. See documentation for **-msq***.""" 3968 3969 def run( 3970 self, 3971 execution: Execution, 3972 ) -> list[str]: 3973 """ 3974 Build command line arguments. This method is called by the main command. 3975 3976 Args: 3977 execution: The execution object. 3978 Returns: 3979 Command line arguments 3980 """ 3981 cargs = [] 3982 cargs.extend([ 3983 "-ncor", 3984 self.normalized_correlation 3985 ]) 3986 return cargs
-ncor, -normalized-correlation: Compute normalized correlation metric
Syntax: -ncor [movtransform.mat] [reftransform.mat]
: Compute the normalized correlation metric between the last two images on the stack. See documentation for -msq*.
-ncor, -normalized-correlation: Compute normalized correlation metric
Syntax: -ncor [movtransform.mat] [reftransform.mat]
: Compute the normalized correlation metric between the last two images on the stack. See documentation for -msq*.
3969 def run( 3970 self, 3971 execution: Execution, 3972 ) -> list[str]: 3973 """ 3974 Build command line arguments. This method is called by the main command. 3975 3976 Args: 3977 execution: The execution object. 3978 Returns: 3979 Command line arguments 3980 """ 3981 cargs = [] 3982 cargs.extend([ 3983 "-ncor", 3984 self.normalized_correlation 3985 ]) 3986 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3905@dataclasses.dataclass 3906class C3dNormalizedCrossCorrelation: 3907 """ 3908 -ncc, -normalized-cross-correlation: Compute normalized cross-correlation 3909 image 3910 3911 Syntax: `-ncc <radius_vector>` 3912 3913 Computes normalized cross-correlation between two images that occupy the 3914 same physical space. Each voxel in the resulting image is the 3915 cross-correlation of patches of given radius surrounding the voxel in the 3916 two input images. This is different from **-ncor**, which computes a global 3917 cross-correlation metric value. 3918 """ 3919 normalized_cross_correlation: str 3920 """-ncc, -normalized-cross-correlation: Compute normalized cross-correlation 3921 image 3922 3923 Syntax: `-ncc <radius_vector>` 3924 3925 Computes normalized cross-correlation between two images that occupy the 3926 same physical space. Each voxel in the resulting image is the 3927 cross-correlation of patches of given radius surrounding the voxel in the 3928 two input images. This is different from **-ncor**, which computes a global 3929 cross-correlation metric value.""" 3930 3931 def run( 3932 self, 3933 execution: Execution, 3934 ) -> list[str]: 3935 """ 3936 Build command line arguments. This method is called by the main command. 3937 3938 Args: 3939 execution: The execution object. 3940 Returns: 3941 Command line arguments 3942 """ 3943 cargs = [] 3944 cargs.extend([ 3945 "-ncc", 3946 self.normalized_cross_correlation 3947 ]) 3948 return cargs
-ncc, -normalized-cross-correlation: Compute normalized cross-correlation image
Syntax: -ncc <radius_vector>
Computes normalized cross-correlation between two images that occupy the same physical space. Each voxel in the resulting image is the cross-correlation of patches of given radius surrounding the voxel in the two input images. This is different from -ncor, which computes a global cross-correlation metric value.
-ncc, -normalized-cross-correlation: Compute normalized cross-correlation image
Syntax: -ncc <radius_vector>
Computes normalized cross-correlation between two images that occupy the same physical space. Each voxel in the resulting image is the cross-correlation of patches of given radius surrounding the voxel in the two input images. This is different from -ncor, which computes a global cross-correlation metric value.
3931 def run( 3932 self, 3933 execution: Execution, 3934 ) -> list[str]: 3935 """ 3936 Build command line arguments. This method is called by the main command. 3937 3938 Args: 3939 execution: The execution object. 3940 Returns: 3941 Command line arguments 3942 """ 3943 cargs = [] 3944 cargs.extend([ 3945 "-ncc", 3946 self.normalized_cross_correlation 3947 ]) 3948 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3989@dataclasses.dataclass 3990class C3dNormalizedMutualInfo: 3991 """ 3992 -mmi, -mattes-mutual-info: Compute mutual informaiton metric 3993 3994 Syntax: `-nmi [movtransform.mat] [reftransform.mat]` 3995 3996 Compute the Mattes mutual information metric between the last two images on 3997 the stack. See documentation for **-msq**. 3998 """ 3999 normalized_mutual_info: str 4000 """-mmi, -mattes-mutual-info: Compute mutual informaiton metric 4001 4002 Syntax: `-nmi [movtransform.mat] [reftransform.mat]` 4003 4004 Compute the Mattes mutual information metric between the last two images on 4005 the stack. See documentation for **-msq**.""" 4006 4007 def run( 4008 self, 4009 execution: Execution, 4010 ) -> list[str]: 4011 """ 4012 Build command line arguments. This method is called by the main command. 4013 4014 Args: 4015 execution: The execution object. 4016 Returns: 4017 Command line arguments 4018 """ 4019 cargs = [] 4020 cargs.extend([ 4021 "-nmi", 4022 self.normalized_mutual_info 4023 ]) 4024 return cargs
-mmi, -mattes-mutual-info: Compute mutual informaiton metric
Syntax: -nmi [movtransform.mat] [reftransform.mat]
Compute the Mattes mutual information metric between the last two images on the stack. See documentation for -msq.
-mmi, -mattes-mutual-info: Compute mutual informaiton metric
Syntax: -nmi [movtransform.mat] [reftransform.mat]
Compute the Mattes mutual information metric between the last two images on the stack. See documentation for -msq.
4007 def run( 4008 self, 4009 execution: Execution, 4010 ) -> list[str]: 4011 """ 4012 Build command line arguments. This method is called by the main command. 4013 4014 Args: 4015 execution: The execution object. 4016 Returns: 4017 Command line arguments 4018 """ 4019 cargs = [] 4020 cargs.extend([ 4021 "-nmi", 4022 self.normalized_mutual_info 4023 ]) 4024 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4277@dataclasses.dataclass 4278class C3dNormpdf: 4279 """ 4280 No description found. 4281 """ 4282 normpdf: str 4283 """No description found.""" 4284 4285 def run( 4286 self, 4287 execution: Execution, 4288 ) -> list[str]: 4289 """ 4290 Build command line arguments. This method is called by the main command. 4291 4292 Args: 4293 execution: The execution object. 4294 Returns: 4295 Command line arguments 4296 """ 4297 cargs = [] 4298 cargs.extend([ 4299 "-normpdf", 4300 self.normpdf 4301 ]) 4302 return cargs
No description found.
4285 def run( 4286 self, 4287 execution: Execution, 4288 ) -> list[str]: 4289 """ 4290 Build command line arguments. This method is called by the main command. 4291 4292 Args: 4293 execution: The execution object. 4294 Returns: 4295 Command line arguments 4296 """ 4297 cargs = [] 4298 cargs.extend([ 4299 "-normpdf", 4300 self.normpdf 4301 ]) 4302 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4305@dataclasses.dataclass 4306class C3dNoround: 4307 """ 4308 -noround, -round: Floating point rounding behavior 4309 4310 Syntax: `-noround` or `-round ` 4311 4312 By default, **convert3d** will round floating point values when converting 4313 to an integer, short or byte image. This command specifies that rounding 4314 should not be used. Rounding is used to avoid numerical errors stemming from 4315 the internal floating point representation. 4316 4317 c3d image1.img -type short -noround image2.img. 4318 """ 4319 noround: str 4320 """-noround, -round: Floating point rounding behavior 4321 4322 Syntax: `-noround` or `-round ` 4323 4324 By default, **convert3d** will round floating point values when converting 4325 to an integer, short or byte image. This command specifies that rounding 4326 should not be used. Rounding is used to avoid numerical errors stemming from 4327 the internal floating point representation. 4328 4329 c3d image1.img -type short -noround image2.img""" 4330 4331 def run( 4332 self, 4333 execution: Execution, 4334 ) -> list[str]: 4335 """ 4336 Build command line arguments. This method is called by the main command. 4337 4338 Args: 4339 execution: The execution object. 4340 Returns: 4341 Command line arguments 4342 """ 4343 cargs = [] 4344 cargs.extend([ 4345 "-noround", 4346 self.noround 4347 ]) 4348 return cargs
-noround, -round: Floating point rounding behavior
Syntax: -noround or -round
By default, convert3d will round floating point values when converting to an integer, short or byte image. This command specifies that rounding should not be used. Rounding is used to avoid numerical errors stemming from the internal floating point representation.
c3d image1.img -type short -noround image2.img.
-noround, -round: Floating point rounding behavior
Syntax: -noround or -round
By default, convert3d will round floating point values when converting to an integer, short or byte image. This command specifies that rounding should not be used. Rounding is used to avoid numerical errors stemming from the internal floating point representation.
c3d image1.img -type short -noround image2.img
4331 def run( 4332 self, 4333 execution: Execution, 4334 ) -> list[str]: 4335 """ 4336 Build command line arguments. This method is called by the main command. 4337 4338 Args: 4339 execution: The execution object. 4340 Returns: 4341 Command line arguments 4342 """ 4343 cargs = [] 4344 cargs.extend([ 4345 "-noround", 4346 self.noround 4347 ]) 4348 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4351@dataclasses.dataclass 4352class C3dNospm: 4353 """ 4354 -spm, -nospm: SPM compatibility in Analyze output 4355 4356 Syntax: `-spm` or `-nospm ` 4357 4358 These options specify whether use the SPM extension to the Analyze 4359 (.hdr,.img) format. When this option is on, the origin field stored by SPM 4360 in the Analyze header will be correctly interpreted. When saving analyze 4361 files, the origin will be set correctly. The default is equivalent to the 4362 **-nospm** option. Best to avoid this issue altogether by using NIFTI and 4363 SPM5 or later. 4364 4365 c3d -spm in.hdr out.img.gz. 4366 """ 4367 nospm: str 4368 """-spm, -nospm: SPM compatibility in Analyze output 4369 4370 Syntax: `-spm` or `-nospm ` 4371 4372 These options specify whether use the SPM extension to the Analyze 4373 (.hdr,.img) format. When this option is on, the origin field stored by SPM 4374 in the Analyze header will be correctly interpreted. When saving analyze 4375 files, the origin will be set correctly. The default is equivalent to the 4376 **-nospm** option. Best to avoid this issue altogether by using NIFTI and 4377 SPM5 or later. 4378 4379 c3d -spm in.hdr out.img.gz""" 4380 4381 def run( 4382 self, 4383 execution: Execution, 4384 ) -> list[str]: 4385 """ 4386 Build command line arguments. This method is called by the main command. 4387 4388 Args: 4389 execution: The execution object. 4390 Returns: 4391 Command line arguments 4392 """ 4393 cargs = [] 4394 cargs.extend([ 4395 "-nospm", 4396 self.nospm 4397 ]) 4398 return cargs
-spm, -nospm: SPM compatibility in Analyze output
Syntax: -spm or -nospm
These options specify whether use the SPM extension to the Analyze (.hdr,.img) format. When this option is on, the origin field stored by SPM in the Analyze header will be correctly interpreted. When saving analyze files, the origin will be set correctly. The default is equivalent to the -nospm option. Best to avoid this issue altogether by using NIFTI and SPM5 or later.
c3d -spm in.hdr out.img.gz.
-spm, -nospm: SPM compatibility in Analyze output
Syntax: -spm or -nospm
These options specify whether use the SPM extension to the Analyze (.hdr,.img) format. When this option is on, the origin field stored by SPM in the Analyze header will be correctly interpreted. When saving analyze files, the origin will be set correctly. The default is equivalent to the -nospm option. Best to avoid this issue altogether by using NIFTI and SPM5 or later.
c3d -spm in.hdr out.img.gz
4381 def run( 4382 self, 4383 execution: Execution, 4384 ) -> list[str]: 4385 """ 4386 Build command line arguments. This method is called by the main command. 4387 4388 Args: 4389 execution: The execution object. 4390 Returns: 4391 Command line arguments 4392 """ 4393 cargs = [] 4394 cargs.extend([ 4395 "-nospm", 4396 self.nospm 4397 ]) 4398 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8102@dataclasses.dataclass 8103class C3dNoverbose: 8104 """ 8105 No description found. 8106 """ 8107 noverbose: str 8108 """No description found.""" 8109 8110 def run( 8111 self, 8112 execution: Execution, 8113 ) -> list[str]: 8114 """ 8115 Build command line arguments. This method is called by the main command. 8116 8117 Args: 8118 execution: The execution object. 8119 Returns: 8120 Command line arguments 8121 """ 8122 cargs = [] 8123 cargs.extend([ 8124 "-noverbose", 8125 self.noverbose 8126 ]) 8127 return cargs
No description found.
8110 def run( 8111 self, 8112 execution: Execution, 8113 ) -> list[str]: 8114 """ 8115 Build command line arguments. This method is called by the main command. 8116 8117 Args: 8118 execution: The execution object. 8119 Returns: 8120 Command line arguments 8121 """ 8122 cargs = [] 8123 cargs.extend([ 8124 "-noverbose", 8125 self.noverbose 8126 ]) 8127 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4618@dataclasses.dataclass 4619class C3dOrient: 4620 """ 4621 -orient: Change image orientation 4622 4623 Syntax: `-orient CODE` 4624 4625 Set the orientation of the image using one of 48 canonical orientations. The 4626 orientation describes the mapping from the voxel coordinate system (i,j,k) 4627 to the physical coordinate system (x,y,z). In the voxel coordinate system, i 4628 runs along columns of voxels, j runs along rows of voxels, and k runs along 4629 slices of voxels. It is assumed (by the NIFTI convention) that the axes of 4630 the physical coordinate system run as follows: x from (L)eft to (R)ight, y 4631 from (P)osterior to (A)nterior, z from (I)nferior to (S)uperior. 4632 4633 The CODE passed in is a three-letter code consisting of letters RLAPSI. Each 4634 letter describes the anatomical direction corresponding to the voxel 4635 coordinates (i,j,k). For example, code RAI means that i runs from Right to 4636 Left, j from Anterior to Posterior, and k from Inferior to Superior. 4637 4638 c3d input.img -orient RAI -o output.img 4639 c3d input.img -orient SAL -o output.img 4640 4641 This command has the same behavior as the 'Reorient Image' menu option in 4642 ITK-SNAP. 4643 """ 4644 orient: str 4645 """-orient: Change image orientation 4646 4647 Syntax: `-orient CODE` 4648 4649 Set the orientation of the image using one of 48 canonical orientations. The 4650 orientation describes the mapping from the voxel coordinate system (i,j,k) 4651 to the physical coordinate system (x,y,z). In the voxel coordinate system, i 4652 runs along columns of voxels, j runs along rows of voxels, and k runs along 4653 slices of voxels. It is assumed (by the NIFTI convention) that the axes of 4654 the physical coordinate system run as follows: x from (L)eft to (R)ight, y 4655 from (P)osterior to (A)nterior, z from (I)nferior to (S)uperior. 4656 4657 The CODE passed in is a three-letter code consisting of letters RLAPSI. Each 4658 letter describes the anatomical direction corresponding to the voxel 4659 coordinates (i,j,k). For example, code RAI means that i runs from Right to 4660 Left, j from Anterior to Posterior, and k from Inferior to Superior. 4661 4662 c3d input.img -orient RAI -o output.img 4663 c3d input.img -orient SAL -o output.img 4664 4665 This command has the same behavior as the 'Reorient Image' menu option in 4666 ITK-SNAP.""" 4667 4668 def run( 4669 self, 4670 execution: Execution, 4671 ) -> list[str]: 4672 """ 4673 Build command line arguments. This method is called by the main command. 4674 4675 Args: 4676 execution: The execution object. 4677 Returns: 4678 Command line arguments 4679 """ 4680 cargs = [] 4681 cargs.extend([ 4682 "-orient", 4683 self.orient 4684 ]) 4685 return cargs
-orient: Change image orientation
Syntax: -orient CODE
Set the orientation of the image using one of 48 canonical orientations. The orientation describes the mapping from the voxel coordinate system (i,j,k) to the physical coordinate system (x,y,z). In the voxel coordinate system, i runs along columns of voxels, j runs along rows of voxels, and k runs along slices of voxels. It is assumed (by the NIFTI convention) that the axes of the physical coordinate system run as follows: x from (L)eft to (R)ight, y from (P)osterior to (A)nterior, z from (I)nferior to (S)uperior.
The CODE passed in is a three-letter code consisting of letters RLAPSI. Each letter describes the anatomical direction corresponding to the voxel coordinates (i,j,k). For example, code RAI means that i runs from Right to Left, j from Anterior to Posterior, and k from Inferior to Superior.
c3d input.img -orient RAI -o output.img c3d input.img -orient SAL -o output.img
This command has the same behavior as the 'Reorient Image' menu option in ITK-SNAP.
-orient: Change image orientation
Syntax: -orient CODE
Set the orientation of the image using one of 48 canonical orientations. The orientation describes the mapping from the voxel coordinate system (i,j,k) to the physical coordinate system (x,y,z). In the voxel coordinate system, i runs along columns of voxels, j runs along rows of voxels, and k runs along slices of voxels. It is assumed (by the NIFTI convention) that the axes of the physical coordinate system run as follows: x from (L)eft to (R)ight, y from (P)osterior to (A)nterior, z from (I)nferior to (S)uperior.
The CODE passed in is a three-letter code consisting of letters RLAPSI. Each letter describes the anatomical direction corresponding to the voxel coordinates (i,j,k). For example, code RAI means that i runs from Right to Left, j from Anterior to Posterior, and k from Inferior to Superior.
c3d input.img -orient RAI -o output.img c3d input.img -orient SAL -o output.img
This command has the same behavior as the 'Reorient Image' menu option in ITK-SNAP.
4668 def run( 4669 self, 4670 execution: Execution, 4671 ) -> list[str]: 4672 """ 4673 Build command line arguments. This method is called by the main command. 4674 4675 Args: 4676 execution: The execution object. 4677 Returns: 4678 Command line arguments 4679 """ 4680 cargs = [] 4681 cargs.extend([ 4682 "-orient", 4683 self.orient 4684 ]) 4685 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4762@dataclasses.dataclass 4763class C3dOrient_: 4764 """ 4765 -orient: Change image orientation 4766 4767 Syntax: `-orient CODE` 4768 4769 Set the orientation of the image using one of 48 canonical orientations. The 4770 orientation describes the mapping from the voxel coordinate system (i,j,k) 4771 to the physical coordinate system (x,y,z). In the voxel coordinate system, i 4772 runs along columns of voxels, j runs along rows of voxels, and k runs along 4773 slices of voxels. It is assumed (by the NIFTI convention) that the axes of 4774 the physical coordinate system run as follows: x from (L)eft to (R)ight, y 4775 from (P)osterior to (A)nterior, z from (I)nferior to (S)uperior. 4776 4777 The CODE passed in is a three-letter code consisting of letters RLAPSI. Each 4778 letter describes the anatomical direction corresponding to the voxel 4779 coordinates (i,j,k). For example, code RAI means that i runs from Right to 4780 Left, j from Anterior to Posterior, and k from Inferior to Superior. 4781 4782 c3d input.img -orient RAI -o output.img 4783 c3d input.img -orient SAL -o output.img 4784 4785 This command has the same behavior as the 'Reorient Image' menu option in 4786 ITK-SNAP. 4787 """ 4788 orient: str 4789 """-orient: Change image orientation 4790 4791 Syntax: `-orient CODE` 4792 4793 Set the orientation of the image using one of 48 canonical orientations. The 4794 orientation describes the mapping from the voxel coordinate system (i,j,k) 4795 to the physical coordinate system (x,y,z). In the voxel coordinate system, i 4796 runs along columns of voxels, j runs along rows of voxels, and k runs along 4797 slices of voxels. It is assumed (by the NIFTI convention) that the axes of 4798 the physical coordinate system run as follows: x from (L)eft to (R)ight, y 4799 from (P)osterior to (A)nterior, z from (I)nferior to (S)uperior. 4800 4801 The CODE passed in is a three-letter code consisting of letters RLAPSI. Each 4802 letter describes the anatomical direction corresponding to the voxel 4803 coordinates (i,j,k). For example, code RAI means that i runs from Right to 4804 Left, j from Anterior to Posterior, and k from Inferior to Superior. 4805 4806 c3d input.img -orient RAI -o output.img 4807 c3d input.img -orient SAL -o output.img 4808 4809 This command has the same behavior as the 'Reorient Image' menu option in 4810 ITK-SNAP.""" 4811 4812 def run( 4813 self, 4814 execution: Execution, 4815 ) -> list[str]: 4816 """ 4817 Build command line arguments. This method is called by the main command. 4818 4819 Args: 4820 execution: The execution object. 4821 Returns: 4822 Command line arguments 4823 """ 4824 cargs = [] 4825 cargs.extend([ 4826 "-orient", 4827 self.orient 4828 ]) 4829 return cargs
-orient: Change image orientation
Syntax: -orient CODE
Set the orientation of the image using one of 48 canonical orientations. The orientation describes the mapping from the voxel coordinate system (i,j,k) to the physical coordinate system (x,y,z). In the voxel coordinate system, i runs along columns of voxels, j runs along rows of voxels, and k runs along slices of voxels. It is assumed (by the NIFTI convention) that the axes of the physical coordinate system run as follows: x from (L)eft to (R)ight, y from (P)osterior to (A)nterior, z from (I)nferior to (S)uperior.
The CODE passed in is a three-letter code consisting of letters RLAPSI. Each letter describes the anatomical direction corresponding to the voxel coordinates (i,j,k). For example, code RAI means that i runs from Right to Left, j from Anterior to Posterior, and k from Inferior to Superior.
c3d input.img -orient RAI -o output.img c3d input.img -orient SAL -o output.img
This command has the same behavior as the 'Reorient Image' menu option in ITK-SNAP.
-orient: Change image orientation
Syntax: -orient CODE
Set the orientation of the image using one of 48 canonical orientations. The orientation describes the mapping from the voxel coordinate system (i,j,k) to the physical coordinate system (x,y,z). In the voxel coordinate system, i runs along columns of voxels, j runs along rows of voxels, and k runs along slices of voxels. It is assumed (by the NIFTI convention) that the axes of the physical coordinate system run as follows: x from (L)eft to (R)ight, y from (P)osterior to (A)nterior, z from (I)nferior to (S)uperior.
The CODE passed in is a three-letter code consisting of letters RLAPSI. Each letter describes the anatomical direction corresponding to the voxel coordinates (i,j,k). For example, code RAI means that i runs from Right to Left, j from Anterior to Posterior, and k from Inferior to Superior.
c3d input.img -orient RAI -o output.img c3d input.img -orient SAL -o output.img
This command has the same behavior as the 'Reorient Image' menu option in ITK-SNAP.
4812 def run( 4813 self, 4814 execution: Execution, 4815 ) -> list[str]: 4816 """ 4817 Build command line arguments. This method is called by the main command. 4818 4819 Args: 4820 execution: The execution object. 4821 Returns: 4822 Command line arguments 4823 """ 4824 cargs = [] 4825 cargs.extend([ 4826 "-orient", 4827 self.orient 4828 ]) 4829 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4832@dataclasses.dataclass 4833class C3dOrigin: 4834 """ 4835 -origin: Set image origin 4836 4837 Syntax: `-origin vector ` 4838 4839 Set the origin of the image. The origin is the world coordinate (in NIfTI 4840 coordinate space) of the center of the voxel (0,0,0) in the image. The 4841 origin should be specified in millimeters. 4842 4843 c3d input.img -origin 100x100x100mm -o output.img. 4844 """ 4845 origin: str 4846 """-origin: Set image origin 4847 4848 Syntax: `-origin vector ` 4849 4850 Set the origin of the image. The origin is the world coordinate (in NIfTI 4851 coordinate space) of the center of the voxel (0,0,0) in the image. The 4852 origin should be specified in millimeters. 4853 4854 c3d input.img -origin 100x100x100mm -o output.img""" 4855 4856 def run( 4857 self, 4858 execution: Execution, 4859 ) -> list[str]: 4860 """ 4861 Build command line arguments. This method is called by the main command. 4862 4863 Args: 4864 execution: The execution object. 4865 Returns: 4866 Command line arguments 4867 """ 4868 cargs = [] 4869 cargs.extend([ 4870 "-origin", 4871 self.origin 4872 ]) 4873 return cargs
-origin: Set image origin
Syntax: -origin vector
Set the origin of the image. The origin is the world coordinate (in NIfTI coordinate space) of the center of the voxel (0,0,0) in the image. The origin should be specified in millimeters.
c3d input.img -origin 100x100x100mm -o output.img.
-origin: Set image origin
Syntax: -origin vector
Set the origin of the image. The origin is the world coordinate (in NIfTI coordinate space) of the center of the voxel (0,0,0) in the image. The origin should be specified in millimeters.
c3d input.img -origin 100x100x100mm -o output.img
4856 def run( 4857 self, 4858 execution: Execution, 4859 ) -> list[str]: 4860 """ 4861 Build command line arguments. This method is called by the main command. 4862 4863 Args: 4864 execution: The execution object. 4865 Returns: 4866 Command line arguments 4867 """ 4868 cargs = [] 4869 cargs.extend([ 4870 "-origin", 4871 self.origin 4872 ]) 4873 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4876@dataclasses.dataclass 4877class C3dOriginVoxel: 4878 """ 4879 -origin-voxel: Assign image origin to a voxel 4880 4881 Syntax: `-origin-voxel vector ` 4882 4883 Set the origin of the image by specifying the voxel coordinates of the 4884 center of the patient (RAS) coordinate system. The vector should be 4885 specified in voxel units. 4886 4887 c3d input.img -origin-voxel 60x70x35 -o output.img 4888 c3d input.img -origin-voxel 50% -o output.img # image centered around 4889 origin. 4890 """ 4891 origin_voxel: str 4892 """-origin-voxel: Assign image origin to a voxel 4893 4894 Syntax: `-origin-voxel vector ` 4895 4896 Set the origin of the image by specifying the voxel coordinates of the 4897 center of the patient (RAS) coordinate system. The vector should be 4898 specified in voxel units. 4899 4900 c3d input.img -origin-voxel 60x70x35 -o output.img 4901 c3d input.img -origin-voxel 50% -o output.img # image centered around 4902 origin""" 4903 4904 def run( 4905 self, 4906 execution: Execution, 4907 ) -> list[str]: 4908 """ 4909 Build command line arguments. This method is called by the main command. 4910 4911 Args: 4912 execution: The execution object. 4913 Returns: 4914 Command line arguments 4915 """ 4916 cargs = [] 4917 cargs.extend([ 4918 "-origin-voxel", 4919 self.origin_voxel 4920 ]) 4921 return cargs
-origin-voxel: Assign image origin to a voxel
Syntax: -origin-voxel vector
Set the origin of the image by specifying the voxel coordinates of the center of the patient (RAS) coordinate system. The vector should be specified in voxel units.
c3d input.img -origin-voxel 60x70x35 -o output.img c3d input.img -origin-voxel 50% -o output.img # image centered around origin.
-origin-voxel: Assign image origin to a voxel
Syntax: -origin-voxel vector
Set the origin of the image by specifying the voxel coordinates of the center of the patient (RAS) coordinate system. The vector should be specified in voxel units.
c3d input.img -origin-voxel 60x70x35 -o output.img c3d input.img -origin-voxel 50% -o output.img # image centered around origin
4904 def run( 4905 self, 4906 execution: Execution, 4907 ) -> list[str]: 4908 """ 4909 Build command line arguments. This method is called by the main command. 4910 4911 Args: 4912 execution: The execution object. 4913 Returns: 4914 Command line arguments 4915 """ 4916 cargs = [] 4917 cargs.extend([ 4918 "-origin-voxel", 4919 self.origin_voxel 4920 ]) 4921 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4924@dataclasses.dataclass 4925class C3dOriginVoxelCoord: 4926 """ 4927 -origin-voxel-coord: Set coordinate of specified voxel 4928 4929 Syntax: `-origin-voxel-coord: <index> <vector>` 4930 4931 This command updates the origin of the image such that the specifed voxel 4932 has the specified coordinate. For example, you can use the command to set 4933 the world coordinate (in NIFTI coordinate space) of the center voxel of the 4934 image, as follows: 4935 4936 c3d input.nii -origin-voxel-coord: 50% 10x10x5mm -o output.nii. 4937 """ 4938 origin_voxel_coord: str 4939 """-origin-voxel-coord: Set coordinate of specified voxel 4940 4941 Syntax: `-origin-voxel-coord: <index> <vector>` 4942 4943 This command updates the origin of the image such that the specifed voxel 4944 has the specified coordinate. For example, you can use the command to set 4945 the world coordinate (in NIFTI coordinate space) of the center voxel of the 4946 image, as follows: 4947 4948 c3d input.nii -origin-voxel-coord: 50% 10x10x5mm -o output.nii""" 4949 4950 def run( 4951 self, 4952 execution: Execution, 4953 ) -> list[str]: 4954 """ 4955 Build command line arguments. This method is called by the main command. 4956 4957 Args: 4958 execution: The execution object. 4959 Returns: 4960 Command line arguments 4961 """ 4962 cargs = [] 4963 cargs.extend([ 4964 "-origin-voxel-coord", 4965 self.origin_voxel_coord 4966 ]) 4967 return cargs
-origin-voxel-coord: Set coordinate of specified voxel
Syntax: -origin-voxel-coord: <index> <vector>
This command updates the origin of the image such that the specifed voxel has the specified coordinate. For example, you can use the command to set the world coordinate (in NIFTI coordinate space) of the center voxel of the image, as follows:
c3d input.nii -origin-voxel-coord: 50% 10x10x5mm -o output.nii.
-origin-voxel-coord: Set coordinate of specified voxel
Syntax: -origin-voxel-coord: <index> <vector>
This command updates the origin of the image such that the specifed voxel has the specified coordinate. For example, you can use the command to set the world coordinate (in NIFTI coordinate space) of the center voxel of the image, as follows:
c3d input.nii -origin-voxel-coord: 50% 10x10x5mm -o output.nii
4950 def run( 4951 self, 4952 execution: Execution, 4953 ) -> list[str]: 4954 """ 4955 Build command line arguments. This method is called by the main command. 4956 4957 Args: 4958 execution: The execution object. 4959 Returns: 4960 Command line arguments 4961 """ 4962 cargs = [] 4963 cargs.extend([ 4964 "-origin-voxel-coord", 4965 self.origin_voxel_coord 4966 ]) 4967 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4411@dataclasses.dataclass 4412class C3dOutput: 4413 """ 4414 -o: Output (write) last image on the stack to image file 4415 4416 Syntax: `-o filename` 4417 4418 Write image, overriding an existing image. Without the **-o** option, 4419 **convert3d** will write an image only if it does not exist. The **-o** 4420 options protects input images from being accidentally deleted. Here we copy 4421 an image, changing format: 4422 4423 c3d image1.mha -o image2.nii 4424 4425 The **-o** option can also be used to save an intermediate image in the 4426 stack: 4427 4428 c3d image1.img -threshold 1 10 1 0 -o thresh.img -resample 50% -o final.img. 4429 """ 4430 output: str 4431 """-o: Output (write) last image on the stack to image file 4432 4433 Syntax: `-o filename` 4434 4435 Write image, overriding an existing image. Without the **-o** option, 4436 **convert3d** will write an image only if it does not exist. The **-o** 4437 options protects input images from being accidentally deleted. Here we copy 4438 an image, changing format: 4439 4440 c3d image1.mha -o image2.nii 4441 4442 The **-o** option can also be used to save an intermediate image in the 4443 stack: 4444 4445 c3d image1.img -threshold 1 10 1 0 -o thresh.img -resample 50% -o 4446 final.img""" 4447 4448 def run( 4449 self, 4450 execution: Execution, 4451 ) -> list[str]: 4452 """ 4453 Build command line arguments. This method is called by the main command. 4454 4455 Args: 4456 execution: The execution object. 4457 Returns: 4458 Command line arguments 4459 """ 4460 cargs = [] 4461 cargs.extend([ 4462 "-o", 4463 self.output 4464 ]) 4465 return cargs 4466 4467 def outputs( 4468 self, 4469 execution: Execution, 4470 ) -> C3dOutputOutputs: 4471 """ 4472 Collect output file paths. 4473 4474 Args: 4475 execution: The execution object. 4476 Returns: 4477 NamedTuple of outputs (described in `C3dOutputOutputs`). 4478 """ 4479 ret = C3dOutputOutputs( 4480 root=execution.output_file("."), 4481 output=execution.output_file(self.output), 4482 ) 4483 return ret
-o: Output (write) last image on the stack to image file
Syntax: -o filename
Write image, overriding an existing image. Without the -o option, convert3d will write an image only if it does not exist. The -o options protects input images from being accidentally deleted. Here we copy an image, changing format:
c3d image1.mha -o image2.nii
The -o option can also be used to save an intermediate image in the stack:
c3d image1.img -threshold 1 10 1 0 -o thresh.img -resample 50% -o final.img.
-o: Output (write) last image on the stack to image file
Syntax: -o filename
Write image, overriding an existing image. Without the -o option, convert3d will write an image only if it does not exist. The -o options protects input images from being accidentally deleted. Here we copy an image, changing format:
c3d image1.mha -o image2.nii
The -o option can also be used to save an intermediate image in the stack:
c3d image1.img -threshold 1 10 1 0 -o thresh.img -resample 50% -o final.img
4448 def run( 4449 self, 4450 execution: Execution, 4451 ) -> list[str]: 4452 """ 4453 Build command line arguments. This method is called by the main command. 4454 4455 Args: 4456 execution: The execution object. 4457 Returns: 4458 Command line arguments 4459 """ 4460 cargs = [] 4461 cargs.extend([ 4462 "-o", 4463 self.output 4464 ]) 4465 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4467 def outputs( 4468 self, 4469 execution: Execution, 4470 ) -> C3dOutputOutputs: 4471 """ 4472 Collect output file paths. 4473 4474 Args: 4475 execution: The execution object. 4476 Returns: 4477 NamedTuple of outputs (described in `C3dOutputOutputs`). 4478 """ 4479 ret = C3dOutputOutputs( 4480 root=execution.output_file("."), 4481 output=execution.output_file(self.output), 4482 ) 4483 return ret
Collect output file paths.
Arguments:
- execution: The execution object.
Returns:
NamedTuple of outputs (described in
C3dOutputOutputs).
4486@dataclasses.dataclass 4487class C3dOutputMulticomponent: 4488 """ 4489 -omc, -output-multicomponent: Output multiple images to single file 4490 4491 Syntax: `-omc [number] filename` 4492 4493 Write multiple images on the **Convert3d** stack as a single multi-component 4494 image file. If the optional number *n* is specified, only the last *n* 4495 images on the stack will be used. Not all file formats support 4496 multi-component output. NIFTI is the safest bet. 4497 4498 c3d red.nii green.nii blue.nii -omc rgb.mha 4499 4500 For 2D images, this command can be used to generate color PNG files: 4501 4502 c3d image.nii -slice z 50% -colormap jet -type uchar -omc colorslice.png. 4503 """ 4504 output_multicomponent: str 4505 """-omc, -output-multicomponent: Output multiple images to single file 4506 4507 Syntax: `-omc [number] filename` 4508 4509 Write multiple images on the **Convert3d** stack as a single multi-component 4510 image file. If the optional number *n* is specified, only the last *n* 4511 images on the stack will be used. Not all file formats support 4512 multi-component output. NIFTI is the safest bet. 4513 4514 c3d red.nii green.nii blue.nii -omc rgb.mha 4515 4516 For 2D images, this command can be used to generate color PNG files: 4517 4518 c3d image.nii -slice z 50% -colormap jet -type uchar -omc colorslice.png""" 4519 4520 def run( 4521 self, 4522 execution: Execution, 4523 ) -> list[str]: 4524 """ 4525 Build command line arguments. This method is called by the main command. 4526 4527 Args: 4528 execution: The execution object. 4529 Returns: 4530 Command line arguments 4531 """ 4532 cargs = [] 4533 cargs.extend([ 4534 "-omc", 4535 self.output_multicomponent 4536 ]) 4537 return cargs
-omc, -output-multicomponent: Output multiple images to single file
Syntax: -omc [number] filename
Write multiple images on the Convert3d stack as a single multi-component image file. If the optional number n is specified, only the last n images on the stack will be used. Not all file formats support multi-component output. NIFTI is the safest bet.
c3d red.nii green.nii blue.nii -omc rgb.mha
For 2D images, this command can be used to generate color PNG files:
c3d image.nii -slice z 50% -colormap jet -type uchar -omc colorslice.png.
-omc, -output-multicomponent: Output multiple images to single file
Syntax: -omc [number] filename
Write multiple images on the Convert3d stack as a single multi-component image file. If the optional number n is specified, only the last n images on the stack will be used. Not all file formats support multi-component output. NIFTI is the safest bet.
c3d red.nii green.nii blue.nii -omc rgb.mha
For 2D images, this command can be used to generate color PNG files:
c3d image.nii -slice z 50% -colormap jet -type uchar -omc colorslice.png
4520 def run( 4521 self, 4522 execution: Execution, 4523 ) -> list[str]: 4524 """ 4525 Build command line arguments. This method is called by the main command. 4526 4527 Args: 4528 execution: The execution object. 4529 Returns: 4530 Command line arguments 4531 """ 4532 cargs = [] 4533 cargs.extend([ 4534 "-omc", 4535 self.output_multicomponent 4536 ]) 4537 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4688@dataclasses.dataclass 4689class C3dOutputMultiple: 4690 """ 4691 -oo: Output multiple images to multiple files 4692 4693 Syntax: `-oo image_list` or `-oo image_spec` 4694 4695 Write all images on the **convert3d** stack as multiple files. There are two 4696 ways to use this command. The first is to supply a list of file names, 4697 separated by spaces: 4698 4699 c3d labelimage.nii -split -oo labelA.nii labelB.nii labelC.nii 4700 4701 In the above example, the image at the end of the stack will be saved as 4702 *labelC.nii*, the image next to the end of the stack will be saved as 4703 *labelB.nii* and so on. 4704 4705 The second way to use the **-oo** command is to supply a pattern for the 4706 output filenames. In this case, all the images on the stack will be written. 4707 The format for the pattern is the same as for the [C++ printf command][8]. 4708 For example, the following command 4709 4710 c3d labelimage.nii -split -oo label%02d.nii 4711 4712 will generate images *label00.nii*, *label01.nii*, *label02.nii* and so on. 4713 The image at the end of the stack will have the highest number, and the 4714 image at the beginning of the stack will have number 00. 4715 """ 4716 output_multiple: str 4717 """-oo: Output multiple images to multiple files 4718 4719 Syntax: `-oo image_list` or `-oo image_spec` 4720 4721 Write all images on the **convert3d** stack as multiple files. There are two 4722 ways to use this command. The first is to supply a list of file names, 4723 separated by spaces: 4724 4725 c3d labelimage.nii -split -oo labelA.nii labelB.nii labelC.nii 4726 4727 In the above example, the image at the end of the stack will be saved as 4728 *labelC.nii*, the image next to the end of the stack will be saved as 4729 *labelB.nii* and so on. 4730 4731 The second way to use the **-oo** command is to supply a pattern for the 4732 output filenames. In this case, all the images on the stack will be written. 4733 The format for the pattern is the same as for the [C++ printf command][8]. 4734 For example, the following command 4735 4736 c3d labelimage.nii -split -oo label%02d.nii 4737 4738 will generate images *label00.nii*, *label01.nii*, *label02.nii* and so on. 4739 The image at the end of the stack will have the highest number, and the 4740 image at the beginning of the stack will have number 00.""" 4741 4742 def run( 4743 self, 4744 execution: Execution, 4745 ) -> list[str]: 4746 """ 4747 Build command line arguments. This method is called by the main command. 4748 4749 Args: 4750 execution: The execution object. 4751 Returns: 4752 Command line arguments 4753 """ 4754 cargs = [] 4755 cargs.extend([ 4756 "-oo", 4757 self.output_multiple 4758 ]) 4759 return cargs
-oo: Output multiple images to multiple files
Syntax: -oo image_list or -oo image_spec
Write all images on the convert3d stack as multiple files. There are two ways to use this command. The first is to supply a list of file names, separated by spaces:
c3d labelimage.nii -split -oo labelA.nii labelB.nii labelC.nii
In the above example, the image at the end of the stack will be saved as labelC.nii, the image next to the end of the stack will be saved as labelB.nii and so on.
The second way to use the -oo command is to supply a pattern for the output filenames. In this case, all the images on the stack will be written. The format for the pattern is the same as for the [C++ printf command][8]. For example, the following command
c3d labelimage.nii -split -oo label%02d.nii
will generate images label00.nii, label01.nii, label02.nii and so on. The image at the end of the stack will have the highest number, and the image at the beginning of the stack will have number 00.
-oo: Output multiple images to multiple files
Syntax: -oo image_list or -oo image_spec
Write all images on the convert3d stack as multiple files. There are two ways to use this command. The first is to supply a list of file names, separated by spaces:
c3d labelimage.nii -split -oo labelA.nii labelB.nii labelC.nii
In the above example, the image at the end of the stack will be saved as labelC.nii, the image next to the end of the stack will be saved as labelB.nii and so on.
The second way to use the -oo command is to supply a pattern for the output filenames. In this case, all the images on the stack will be written. The format for the pattern is the same as for the [C++ printf command][8]. For example, the following command
c3d labelimage.nii -split -oo label%02d.nii
will generate images label00.nii, label01.nii, label02.nii and so on. The image at the end of the stack will have the highest number, and the image at the beginning of the stack will have number 00.
4742 def run( 4743 self, 4744 execution: Execution, 4745 ) -> list[str]: 4746 """ 4747 Build command line arguments. This method is called by the main command. 4748 4749 Args: 4750 execution: The execution object. 4751 Returns: 4752 Command line arguments 4753 """ 4754 cargs = [] 4755 cargs.extend([ 4756 "-oo", 4757 self.output_multiple 4758 ]) 4759 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4540@dataclasses.dataclass 4541class C3dOutputMultipleMulticomponent: 4542 """ 4543 -oomc: Output multiple multi-component images to multiple files 4544 4545 Syntax: `-oomc n_comp image_list` or `-oomc n_comp image_spec` 4546 4547 Write all images on the **convert3d** stack as multiple multi-component 4548 image files. The command is a mixture of the **-omc** and **-oo** commands. 4549 There must be a multiple of 'n_comp' images on the stack. Every consecutive 4550 'n_comp' images on the stack will be written to a separate multi-component 4551 image. 4552 4553 ### Commands: Stack Manipulation and Flow Control 4554 4555 These commands are used to manipulate the **convert3d** stack. The stack is 4556 a linear array of images. Every time an image is specified on the command 4557 line, it is loaded and placed at the end of the stack. Most operations take 4558 one image from the end of the stack, apply some operation to it, and place 4559 the result on the end of the stack. Certain commands like **-levelset** and 4560 **-reslice-matrix** take two images from the end of the stack as the input 4561 and replace them with a single output. Some other commands, like **-mean** 4562 and **-vote** take all images on the stack and replace them with a single 4563 output. 4564 4565 Sometimes, for complex operations, it is useful to change the order of the 4566 images on the stack, to duplicate images, or to execute the same command 4567 multiple times. The stack manipulation and flow control commands allow you 4568 to complete complex tasks without saving intermediate images to the disk. 4569 """ 4570 output_multiple_multicomponent: str 4571 """-oomc: Output multiple multi-component images to multiple files 4572 4573 Syntax: `-oomc n_comp image_list` or `-oomc n_comp image_spec` 4574 4575 Write all images on the **convert3d** stack as multiple multi-component 4576 image files. The command is a mixture of the **-omc** and **-oo** commands. 4577 There must be a multiple of 'n_comp' images on the stack. Every consecutive 4578 'n_comp' images on the stack will be written to a separate multi-component 4579 image. 4580 4581 ### Commands: Stack Manipulation and Flow Control 4582 4583 These commands are used to manipulate the **convert3d** stack. The stack is 4584 a linear array of images. Every time an image is specified on the command 4585 line, it is loaded and placed at the end of the stack. Most operations take 4586 one image from the end of the stack, apply some operation to it, and place 4587 the result on the end of the stack. Certain commands like **-levelset** and 4588 **-reslice-matrix** take two images from the end of the stack as the input 4589 and replace them with a single output. Some other commands, like **-mean** 4590 and **-vote** take all images on the stack and replace them with a single 4591 output. 4592 4593 Sometimes, for complex operations, it is useful to change the order of the 4594 images on the stack, to duplicate images, or to execute the same command 4595 multiple times. The stack manipulation and flow control commands allow you 4596 to complete complex tasks without saving intermediate images to the disk.""" 4597 4598 def run( 4599 self, 4600 execution: Execution, 4601 ) -> list[str]: 4602 """ 4603 Build command line arguments. This method is called by the main command. 4604 4605 Args: 4606 execution: The execution object. 4607 Returns: 4608 Command line arguments 4609 """ 4610 cargs = [] 4611 cargs.extend([ 4612 "-oomc", 4613 self.output_multiple_multicomponent 4614 ]) 4615 return cargs
-oomc: Output multiple multi-component images to multiple files
Syntax: -oomc n_comp image_list or -oomc n_comp image_spec
Write all images on the convert3d stack as multiple multi-component image files. The command is a mixture of the -omc and -oo commands. There must be a multiple of 'n_comp' images on the stack. Every consecutive 'n_comp' images on the stack will be written to a separate multi-component image.
Commands: Stack Manipulation and Flow Control
These commands are used to manipulate the convert3d stack. The stack is a linear array of images. Every time an image is specified on the command line, it is loaded and placed at the end of the stack. Most operations take one image from the end of the stack, apply some operation to it, and place the result on the end of the stack. Certain commands like -levelset and -reslice-matrix take two images from the end of the stack as the input and replace them with a single output. Some other commands, like -mean and -vote take all images on the stack and replace them with a single output.
Sometimes, for complex operations, it is useful to change the order of the images on the stack, to duplicate images, or to execute the same command multiple times. The stack manipulation and flow control commands allow you to complete complex tasks without saving intermediate images to the disk.
-oomc: Output multiple multi-component images to multiple files
Syntax: -oomc n_comp image_list or -oomc n_comp image_spec
Write all images on the convert3d stack as multiple multi-component image files. The command is a mixture of the -omc and -oo commands. There must be a multiple of 'n_comp' images on the stack. Every consecutive 'n_comp' images on the stack will be written to a separate multi-component image.
Commands: Stack Manipulation and Flow Control
These commands are used to manipulate the convert3d stack. The stack is a linear array of images. Every time an image is specified on the command line, it is loaded and placed at the end of the stack. Most operations take one image from the end of the stack, apply some operation to it, and place the result on the end of the stack. Certain commands like -levelset and -reslice-matrix take two images from the end of the stack as the input and replace them with a single output. Some other commands, like -mean and -vote take all images on the stack and replace them with a single output.
Sometimes, for complex operations, it is useful to change the order of the images on the stack, to duplicate images, or to execute the same command multiple times. The stack manipulation and flow control commands allow you to complete complex tasks without saving intermediate images to the disk.
4598 def run( 4599 self, 4600 execution: Execution, 4601 ) -> list[str]: 4602 """ 4603 Build command line arguments. This method is called by the main command. 4604 4605 Args: 4606 execution: The execution object. 4607 Returns: 4608 Command line arguments 4609 """ 4610 cargs = [] 4611 cargs.extend([ 4612 "-oomc", 4613 self.output_multiple_multicomponent 4614 ]) 4615 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4401class C3dOutputOutputs(typing.NamedTuple): 4402 """ 4403 Output object returned when calling `C3dOutput(...)`. 4404 """ 4405 root: OutputPathType 4406 """Output root folder. This is the root folder for all outputs.""" 4407 output: OutputPathType 4408 """The output"""
Output object returned when calling C3dOutput(...).
8788class C3dOutputs(typing.NamedTuple): 8789 """ 8790 Output object returned when calling `c3d_(...)`. 8791 """ 8792 root: OutputPathType 8793 """Output root folder. This is the root folder for all outputs.""" 8794 operations: typing.List[typing.Union[C3dOutputOutputs]] 8795 """Outputs from `C3dOutput`.This is a list of outputs with the same length 8796 and order as the inputs."""
Output object returned when calling c3d_(...).
Create new instance of C3dOutputs(root, operations)
Outputs from C3dOutput.This is a list of outputs with the same length
and order as the inputs.
4970@dataclasses.dataclass 4971class C3dOverlap: 4972 """ 4973 -overlap: Compute relative overlap between binary images 4974 4975 Syntax: `-overlap Z` 4976 4977 Compute relative overlap between labels in the last two images on the stack. 4978 Overlap is computed for a given label **Z**, i.e., the number of voxels that 4979 are equal to **Z** in both images is computed and divided by either the 4980 average number of voxels equal to **Z** in both images (to get Dice 4981 coefficient) or by the size of the region where at least one of the images 4982 is equal to **Z** (Jaccard coefficient). 4983 4984 The command below computes overlap for label 255. 4985 4986 c3d -verbose seg1.img seg2.img -overlap 255 4987 4988 The output of the command is in the following terse format, with the last 4989 two values giving Dice and Jaccard coefficients, respectively. 4990 4991 OVL: 1, 2383, 2474, 1807, 0.744081, 0.592459 4992 4993 Use the flag **-verbose** to get full information. 4994 4995 Matching voxels in first image: 2383 4996 Matching voxels in second image: 2474 4997 Size of overlap region: 1807 4998 Dice similarity coefficient: 0.744081 4999 Intersection / ratio: 0.592459 5000 5001 This command does not alter the stack. 5002 """ 5003 overlap: str 5004 """-overlap: Compute relative overlap between binary images 5005 5006 Syntax: `-overlap Z` 5007 5008 Compute relative overlap between labels in the last two images on the stack. 5009 Overlap is computed for a given label **Z**, i.e., the number of voxels that 5010 are equal to **Z** in both images is computed and divided by either the 5011 average number of voxels equal to **Z** in both images (to get Dice 5012 coefficient) or by the size of the region where at least one of the images 5013 is equal to **Z** (Jaccard coefficient). 5014 5015 The command below computes overlap for label 255. 5016 5017 c3d -verbose seg1.img seg2.img -overlap 255 5018 5019 The output of the command is in the following terse format, with the last 5020 two values giving Dice and Jaccard coefficients, respectively. 5021 5022 OVL: 1, 2383, 2474, 1807, 0.744081, 0.592459 5023 5024 Use the flag **-verbose** to get full information. 5025 5026 Matching voxels in first image: 2383 5027 Matching voxels in second image: 2474 5028 Size of overlap region: 1807 5029 Dice similarity coefficient: 0.744081 5030 Intersection / ratio: 0.592459 5031 5032 This command does not alter the stack.""" 5033 5034 def run( 5035 self, 5036 execution: Execution, 5037 ) -> list[str]: 5038 """ 5039 Build command line arguments. This method is called by the main command. 5040 5041 Args: 5042 execution: The execution object. 5043 Returns: 5044 Command line arguments 5045 """ 5046 cargs = [] 5047 cargs.extend([ 5048 "-overlap", 5049 self.overlap 5050 ]) 5051 return cargs
-overlap: Compute relative overlap between binary images
Syntax: -overlap Z
Compute relative overlap between labels in the last two images on the stack. Overlap is computed for a given label Z, i.e., the number of voxels that are equal to Z in both images is computed and divided by either the average number of voxels equal to Z in both images (to get Dice coefficient) or by the size of the region where at least one of the images is equal to Z (Jaccard coefficient).
The command below computes overlap for label 255.
c3d -verbose seg1.img seg2.img -overlap 255
The output of the command is in the following terse format, with the last two values giving Dice and Jaccard coefficients, respectively.
OVL: 1, 2383, 2474, 1807, 0.744081, 0.592459
Use the flag -verbose to get full information.
Matching voxels in first image: 2383 Matching voxels in second image: 2474 Size of overlap region: 1807 Dice similarity coefficient: 0.744081 Intersection / ratio: 0.592459
This command does not alter the stack.
-overlap: Compute relative overlap between binary images
Syntax: -overlap Z
Compute relative overlap between labels in the last two images on the stack. Overlap is computed for a given label Z, i.e., the number of voxels that are equal to Z in both images is computed and divided by either the average number of voxels equal to Z in both images (to get Dice coefficient) or by the size of the region where at least one of the images is equal to Z (Jaccard coefficient).
The command below computes overlap for label 255.
c3d -verbose seg1.img seg2.img -overlap 255
The output of the command is in the following terse format, with the last two values giving Dice and Jaccard coefficients, respectively.
OVL: 1, 2383, 2474, 1807, 0.744081, 0.592459
Use the flag -verbose to get full information.
Matching voxels in first image: 2383 Matching voxels in second image: 2474 Size of overlap region: 1807 Dice similarity coefficient: 0.744081 Intersection / ratio: 0.592459
This command does not alter the stack.
5034 def run( 5035 self, 5036 execution: Execution, 5037 ) -> list[str]: 5038 """ 5039 Build command line arguments. This method is called by the main command. 5040 5041 Args: 5042 execution: The execution object. 5043 Returns: 5044 Command line arguments 5045 """ 5046 cargs = [] 5047 cargs.extend([ 5048 "-overlap", 5049 self.overlap 5050 ]) 5051 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5054@dataclasses.dataclass 5055class C3dOverlayLabelImage: 5056 """ 5057 -oli, -overlay-label-image: Overlay segmentation image on grayscale image 5058 5059 Syntax: `-oli lookup_table_file opacity` 5060 5061 This command takes a grayscale image and a label image (i.e. image with a 5062 set of discrete values) and produces red, green and blue components of a 5063 color image. The resulting color image is an overlay of the labels over the 5064 grey image. The first parameter (*lookup\_table*) is a text file with 5065 entries in the format 5066 5067 label_value red green blue alpha 5068 5069 Alpha values must be between 0 and 1. Red, green and blue values should be 5070 on the same order as the intensity of the grey image (typically 0-255). The 5071 text file is compatible with ITK-SNAP and can be generated using the 5072 ITK-SNAP `Segmentation->Save Label Descriptions` command. The second 5073 parameter (*opacity*) is between 0 and 1 and sets the overall opacity of the 5074 overlay. The output of this command is similar to the way ITK-SNAP presents 5075 segmentation data on top of grayscale images. 5076 5077 c3d gray.nii.gz -stretch 2% 98% 0 255 -clip 0 255 seg.nii.gz -oli labels.txt 5078 0.5 -omc rgb.nii.gz 5079 5080 Note: this command does not interpolate between entries in the lookup table. 5081 It should not be used for images with a continuous intensity spectrum. 5082 5083 Here is a more complex example, used to visualize a segmentation result. We 5084 do a few things in this command: trim grayscale and segmentation images to 5085 an ROI around the object of interest; map intensity range of the grayscale 5086 image to 0-255; extract slices through the middle of the cropped images; 5087 overlay segmentation on the grayscale image; and save as a color PNG file. 5088 5089 c3d seg.nii.gz -trim 20x20x0vox -as S gray.nii.gz -stretch 2% 98% 0 255 5090 -clip 0 255 \\ 5091 -reslice-identity -push S -foreach -slice z 50% -flip xy -endfor \\ 5092 -oli labels.txt 0.5 -type uchar -omc ovl.png. 5093 """ 5094 overlay_label_image: str 5095 """-oli, -overlay-label-image: Overlay segmentation image on grayscale image 5096 5097 Syntax: `-oli lookup_table_file opacity` 5098 5099 This command takes a grayscale image and a label image (i.e. image with a 5100 set of discrete values) and produces red, green and blue components of a 5101 color image. The resulting color image is an overlay of the labels over the 5102 grey image. The first parameter (*lookup\_table*) is a text file with 5103 entries in the format 5104 5105 label_value red green blue alpha 5106 5107 Alpha values must be between 0 and 1. Red, green and blue values should be 5108 on the same order as the intensity of the grey image (typically 0-255). The 5109 text file is compatible with ITK-SNAP and can be generated using the 5110 ITK-SNAP `Segmentation->Save Label Descriptions` command. The second 5111 parameter (*opacity*) is between 0 and 1 and sets the overall opacity of the 5112 overlay. The output of this command is similar to the way ITK-SNAP presents 5113 segmentation data on top of grayscale images. 5114 5115 c3d gray.nii.gz -stretch 2% 98% 0 255 -clip 0 255 seg.nii.gz -oli labels.txt 5116 0.5 -omc rgb.nii.gz 5117 5118 Note: this command does not interpolate between entries in the lookup table. 5119 It should not be used for images with a continuous intensity spectrum. 5120 5121 Here is a more complex example, used to visualize a segmentation result. We 5122 do a few things in this command: trim grayscale and segmentation images to 5123 an ROI around the object of interest; map intensity range of the grayscale 5124 image to 0-255; extract slices through the middle of the cropped images; 5125 overlay segmentation on the grayscale image; and save as a color PNG file. 5126 5127 c3d seg.nii.gz -trim 20x20x0vox -as S gray.nii.gz -stretch 2% 98% 0 255 5128 -clip 0 255 \\ 5129 -reslice-identity -push S -foreach -slice z 50% -flip xy -endfor \\ 5130 -oli labels.txt 0.5 -type uchar -omc ovl.png""" 5131 5132 def run( 5133 self, 5134 execution: Execution, 5135 ) -> list[str]: 5136 """ 5137 Build command line arguments. This method is called by the main command. 5138 5139 Args: 5140 execution: The execution object. 5141 Returns: 5142 Command line arguments 5143 """ 5144 cargs = [] 5145 cargs.extend([ 5146 "-overlay-label-image", 5147 self.overlay_label_image 5148 ]) 5149 return cargs
-oli, -overlay-label-image: Overlay segmentation image on grayscale image
Syntax: -oli lookup_table_file opacity
This command takes a grayscale image and a label image (i.e. image with a set of discrete values) and produces red, green and blue components of a color image. The resulting color image is an overlay of the labels over the grey image. The first parameter (lookup_table) is a text file with entries in the format
label_value red green blue alpha
Alpha values must be between 0 and 1. Red, green and blue values should be
on the same order as the intensity of the grey image (typically 0-255). The
text file is compatible with ITK-SNAP and can be generated using the
ITK-SNAP Segmentation->Save Label Descriptions command. The second
parameter (opacity) is between 0 and 1 and sets the overall opacity of the
overlay. The output of this command is similar to the way ITK-SNAP presents
segmentation data on top of grayscale images.
c3d gray.nii.gz -stretch 2% 98% 0 255 -clip 0 255 seg.nii.gz -oli labels.txt 0.5 -omc rgb.nii.gz
Note: this command does not interpolate between entries in the lookup table. It should not be used for images with a continuous intensity spectrum.
Here is a more complex example, used to visualize a segmentation result. We do a few things in this command: trim grayscale and segmentation images to an ROI around the object of interest; map intensity range of the grayscale image to 0-255; extract slices through the middle of the cropped images; overlay segmentation on the grayscale image; and save as a color PNG file.
c3d seg.nii.gz -trim 20x20x0vox -as S gray.nii.gz -stretch 2% 98% 0 255 -clip 0 255 \ -reslice-identity -push S -foreach -slice z 50% -flip xy -endfor \ -oli labels.txt 0.5 -type uchar -omc ovl.png.
-oli, -overlay-label-image: Overlay segmentation image on grayscale image
Syntax: -oli lookup_table_file opacity
This command takes a grayscale image and a label image (i.e. image with a set of discrete values) and produces red, green and blue components of a color image. The resulting color image is an overlay of the labels over the grey image. The first parameter (lookup_table) is a text file with entries in the format
label_value red green blue alpha
Alpha values must be between 0 and 1. Red, green and blue values should be
on the same order as the intensity of the grey image (typically 0-255). The
text file is compatible with ITK-SNAP and can be generated using the
ITK-SNAP Segmentation->Save Label Descriptions command. The second
parameter (opacity) is between 0 and 1 and sets the overall opacity of the
overlay. The output of this command is similar to the way ITK-SNAP presents
segmentation data on top of grayscale images.
c3d gray.nii.gz -stretch 2% 98% 0 255 -clip 0 255 seg.nii.gz -oli labels.txt 0.5 -omc rgb.nii.gz
Note: this command does not interpolate between entries in the lookup table. It should not be used for images with a continuous intensity spectrum.
Here is a more complex example, used to visualize a segmentation result. We do a few things in this command: trim grayscale and segmentation images to an ROI around the object of interest; map intensity range of the grayscale image to 0-255; extract slices through the middle of the cropped images; overlay segmentation on the grayscale image; and save as a color PNG file.
c3d seg.nii.gz -trim 20x20x0vox -as S gray.nii.gz -stretch 2% 98% 0 255 -clip 0 255 \ -reslice-identity -push S -foreach -slice z 50% -flip xy -endfor \ -oli labels.txt 0.5 -type uchar -omc ovl.png
5132 def run( 5133 self, 5134 execution: Execution, 5135 ) -> list[str]: 5136 """ 5137 Build command line arguments. This method is called by the main command. 5138 5139 Args: 5140 execution: The execution object. 5141 Returns: 5142 Command line arguments 5143 """ 5144 cargs = [] 5145 cargs.extend([ 5146 "-overlay-label-image", 5147 self.overlay_label_image 5148 ]) 5149 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5152@dataclasses.dataclass 5153class C3dPad: 5154 """ 5155 -pad: Pad image with constant value 5156 5157 Syntax: `-pad <padlower> <padupper> <value> ` 5158 5159 Pads the image by a given percentage or number of voxels. The *padlower* 5160 dimension pads along the zero faces of the image, and the *padupper* 5161 dimension pads along the upper faces of the image. For example to add 1 5162 voxel to the left side of an image, do 5163 5164 c3d img1.nii -pad 1x0x0vox 0x0x0vox 0 -o padded.nii 5165 5166 while 5167 5168 c3d img1.nii -pad 2x2x4vox 0% 0 -o padded.nii 5169 5170 adds two voxels padding to the left and posterior sides, and four slices to 5171 the bottom of the image. Note that the first argument changes the location 5172 of voxel (0,0,0) and thus the origin of the output image will be changed to 5173 maintain anatomical alignment between the padded and original images. 5174 5175 Normally you will want to pad with zeros, but you can pad with any constant 5176 value, eg : 5177 5178 c3d img1.nii -pad 10% 10% 1 -o padded.nii 5179 5180 Adds 10% to all sides of the image, and fills the new voxels with the value 5181 1. 5182 """ 5183 pad: str 5184 """-pad: Pad image with constant value 5185 5186 Syntax: `-pad <padlower> <padupper> <value> ` 5187 5188 Pads the image by a given percentage or number of voxels. The *padlower* 5189 dimension pads along the zero faces of the image, and the *padupper* 5190 dimension pads along the upper faces of the image. For example to add 1 5191 voxel to the left side of an image, do 5192 5193 c3d img1.nii -pad 1x0x0vox 0x0x0vox 0 -o padded.nii 5194 5195 while 5196 5197 c3d img1.nii -pad 2x2x4vox 0% 0 -o padded.nii 5198 5199 adds two voxels padding to the left and posterior sides, and four slices to 5200 the bottom of the image. Note that the first argument changes the location 5201 of voxel (0,0,0) and thus the origin of the output image will be changed to 5202 maintain anatomical alignment between the padded and original images. 5203 5204 Normally you will want to pad with zeros, but you can pad with any constant 5205 value, eg : 5206 5207 c3d img1.nii -pad 10% 10% 1 -o padded.nii 5208 5209 Adds 10% to all sides of the image, and fills the new voxels with the value 5210 1.""" 5211 5212 def run( 5213 self, 5214 execution: Execution, 5215 ) -> list[str]: 5216 """ 5217 Build command line arguments. This method is called by the main command. 5218 5219 Args: 5220 execution: The execution object. 5221 Returns: 5222 Command line arguments 5223 """ 5224 cargs = [] 5225 cargs.extend([ 5226 "-pad", 5227 self.pad 5228 ]) 5229 return cargs
-pad: Pad image with constant value
Syntax: -pad <padlower> <padupper> <value>
Pads the image by a given percentage or number of voxels. The padlower dimension pads along the zero faces of the image, and the padupper dimension pads along the upper faces of the image. For example to add 1 voxel to the left side of an image, do
c3d img1.nii -pad 1x0x0vox 0x0x0vox 0 -o padded.nii
while
c3d img1.nii -pad 2x2x4vox 0% 0 -o padded.nii
adds two voxels padding to the left and posterior sides, and four slices to the bottom of the image. Note that the first argument changes the location of voxel (0,0,0) and thus the origin of the output image will be changed to maintain anatomical alignment between the padded and original images.
Normally you will want to pad with zeros, but you can pad with any constant value, eg :
c3d img1.nii -pad 10% 10% 1 -o padded.nii
Adds 10% to all sides of the image, and fills the new voxels with the value 1.
-pad: Pad image with constant value
Syntax: -pad <padlower> <padupper> <value>
Pads the image by a given percentage or number of voxels. The padlower dimension pads along the zero faces of the image, and the padupper dimension pads along the upper faces of the image. For example to add 1 voxel to the left side of an image, do
c3d img1.nii -pad 1x0x0vox 0x0x0vox 0 -o padded.nii
while
c3d img1.nii -pad 2x2x4vox 0% 0 -o padded.nii
adds two voxels padding to the left and posterior sides, and four slices to the bottom of the image. Note that the first argument changes the location of voxel (0,0,0) and thus the origin of the output image will be changed to maintain anatomical alignment between the padded and original images.
Normally you will want to pad with zeros, but you can pad with any constant value, eg :
c3d img1.nii -pad 10% 10% 1 -o padded.nii
Adds 10% to all sides of the image, and fills the new voxels with the value 1.
5212 def run( 5213 self, 5214 execution: Execution, 5215 ) -> list[str]: 5216 """ 5217 Build command line arguments. This method is called by the main command. 5218 5219 Args: 5220 execution: The execution object. 5221 Returns: 5222 Command line arguments 5223 """ 5224 cargs = [] 5225 cargs.extend([ 5226 "-pad", 5227 self.pad 5228 ]) 5229 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5232@dataclasses.dataclass 5233class C3dPadTo: 5234 """ 5235 No description found. 5236 """ 5237 pad_to: str 5238 """No description found.""" 5239 5240 def run( 5241 self, 5242 execution: Execution, 5243 ) -> list[str]: 5244 """ 5245 Build command line arguments. This method is called by the main command. 5246 5247 Args: 5248 execution: The execution object. 5249 Returns: 5250 Command line arguments 5251 """ 5252 cargs = [] 5253 cargs.extend([ 5254 "-padto", 5255 self.pad_to 5256 ]) 5257 return cargs
No description found.
5240 def run( 5241 self, 5242 execution: Execution, 5243 ) -> list[str]: 5244 """ 5245 Build command line arguments. This method is called by the main command. 5246 5247 Args: 5248 execution: The execution object. 5249 Returns: 5250 Command line arguments 5251 """ 5252 cargs = [] 5253 cargs.extend([ 5254 "-padto", 5255 self.pad_to 5256 ]) 5257 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5260@dataclasses.dataclass 5261class C3dPca: 5262 """ 5263 -pca: Principal components analysis of foreground voxels 5264 5265 Syntax: `-pca` 5266 5267 Similar to the *-centroid* command, computes the centroid and prinicipal 5268 components of the foregrond voxels in the image. For example if the image is 5269 a binary image of an ellipsoid, this will report the center and the 5270 principal axes of the ellipsoid, in physical NIFTI coordinates. 5271 5272 c3d binaryimage.img -pca // centroid of all non-0 voxels 5273 c3d labelimage.img -thresh 5 5 1 0 -pca // centroid of all voxels with label 5274 5 5275 c3d labelimage.img -split -foreach -pca -endfor // centroids of all labels 5276 (including 0). 5277 """ 5278 pca: str 5279 """-pca: Principal components analysis of foreground voxels 5280 5281 Syntax: `-pca` 5282 5283 Similar to the *-centroid* command, computes the centroid and prinicipal 5284 components of the foregrond voxels in the image. For example if the image is 5285 a binary image of an ellipsoid, this will report the center and the 5286 principal axes of the ellipsoid, in physical NIFTI coordinates. 5287 5288 c3d binaryimage.img -pca // centroid of all non-0 voxels 5289 c3d labelimage.img -thresh 5 5 1 0 -pca // centroid of all voxels with label 5290 5 5291 c3d labelimage.img -split -foreach -pca -endfor // centroids of all labels 5292 (including 0)""" 5293 5294 def run( 5295 self, 5296 execution: Execution, 5297 ) -> list[str]: 5298 """ 5299 Build command line arguments. This method is called by the main command. 5300 5301 Args: 5302 execution: The execution object. 5303 Returns: 5304 Command line arguments 5305 """ 5306 cargs = [] 5307 cargs.extend([ 5308 "-pca", 5309 self.pca 5310 ]) 5311 return cargs
-pca: Principal components analysis of foreground voxels
Syntax: -pca
Similar to the -centroid command, computes the centroid and prinicipal components of the foregrond voxels in the image. For example if the image is a binary image of an ellipsoid, this will report the center and the principal axes of the ellipsoid, in physical NIFTI coordinates.
c3d binaryimage.img -pca // centroid of all non-0 voxels c3d labelimage.img -thresh 5 5 1 0 -pca // centroid of all voxels with label 5 c3d labelimage.img -split -foreach -pca -endfor // centroids of all labels (including 0).
-pca: Principal components analysis of foreground voxels
Syntax: -pca
Similar to the -centroid command, computes the centroid and prinicipal components of the foregrond voxels in the image. For example if the image is a binary image of an ellipsoid, this will report the center and the principal axes of the ellipsoid, in physical NIFTI coordinates.
c3d binaryimage.img -pca // centroid of all non-0 voxels c3d labelimage.img -thresh 5 5 1 0 -pca // centroid of all voxels with label 5 c3d labelimage.img -split -foreach -pca -endfor // centroids of all labels (including 0)
5294 def run( 5295 self, 5296 execution: Execution, 5297 ) -> list[str]: 5298 """ 5299 Build command line arguments. This method is called by the main command. 5300 5301 Args: 5302 execution: The execution object. 5303 Returns: 5304 Command line arguments 5305 """ 5306 cargs = [] 5307 cargs.extend([ 5308 "-pca", 5309 self.pca 5310 ]) 5311 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5314@dataclasses.dataclass 5315class C3dPercentIntensityMode: 5316 """ 5317 -pim, -percent-intensity-mode: Set behavior of % specifier 5318 5319 Syntax: `-pim Quantile | q | ForegroundQuantile | fq | Range | r` 5320 5321 This options changes how the percent sign (%) is interpreted when specifying 5322 intensity values. **Quantile (q)** means that `10%` describes the 10th 5323 percentile of all intensity values in the image (i.e., 10% of the voxels 5324 have lower intensity). **ForegroundQuantile (fq)** is similar, but voxels 5325 with background intensity (see **-background** option) are excluded from the 5326 percentile computation. **Range (r)** changes the meaning of percent sign 5327 from percentile to the range between the minimum and maximum of the image, 5328 and `0.1%` becomes equal to MIN + 0.1 (MAX - MIN). The default is 5329 **Quantile**. 5330 5331 $ c3d comp01.png -verbose -pim Quantile -verbose -threshold 75% inf 1 0 5332 Quantile 0.75 maps to 18 5333 5334 $ c3d comp01.png -verbose -pim ForegroundQuantile -verbose -threshold 75% 5335 inf 1 0 5336 Foreground quantile 0.75 (over 37467 voxels) maps to 58 5337 5338 $ c3d comp01.png -verbose -pim Range -verbose -threshold 75% inf 1 0 5339 Intensity range spec 0.75 maps to 191.25. 5340 """ 5341 percent_intensity_mode: str 5342 """-pim, -percent-intensity-mode: Set behavior of % specifier 5343 5344 Syntax: `-pim Quantile | q | ForegroundQuantile | fq | Range | r` 5345 5346 This options changes how the percent sign (%) is interpreted when specifying 5347 intensity values. **Quantile (q)** means that `10%` describes the 10th 5348 percentile of all intensity values in the image (i.e., 10% of the voxels 5349 have lower intensity). **ForegroundQuantile (fq)** is similar, but voxels 5350 with background intensity (see **-background** option) are excluded from the 5351 percentile computation. **Range (r)** changes the meaning of percent sign 5352 from percentile to the range between the minimum and maximum of the image, 5353 and `0.1%` becomes equal to MIN + 0.1 (MAX - MIN). The default is 5354 **Quantile**. 5355 5356 $ c3d comp01.png -verbose -pim Quantile -verbose -threshold 75% inf 1 0 5357 Quantile 0.75 maps to 18 5358 5359 $ c3d comp01.png -verbose -pim ForegroundQuantile -verbose -threshold 75% 5360 inf 1 0 5361 Foreground quantile 0.75 (over 37467 voxels) maps to 58 5362 5363 $ c3d comp01.png -verbose -pim Range -verbose -threshold 75% inf 1 0 5364 Intensity range spec 0.75 maps to 191.25""" 5365 5366 def run( 5367 self, 5368 execution: Execution, 5369 ) -> list[str]: 5370 """ 5371 Build command line arguments. This method is called by the main command. 5372 5373 Args: 5374 execution: The execution object. 5375 Returns: 5376 Command line arguments 5377 """ 5378 cargs = [] 5379 cargs.extend([ 5380 "-percent-intensity-mode", 5381 self.percent_intensity_mode 5382 ]) 5383 return cargs
-pim, -percent-intensity-mode: Set behavior of % specifier
Syntax: -pim Quantile | q | ForegroundQuantile | fq | Range | r
This options changes how the percent sign (%) is interpreted when specifying
intensity values. Quantile (q) means that 10% describes the 10th
percentile of all intensity values in the image (i.e., 10% of the voxels
have lower intensity). ForegroundQuantile (fq) is similar, but voxels
with background intensity (see -background option) are excluded from the
percentile computation. Range (r) changes the meaning of percent sign
from percentile to the range between the minimum and maximum of the image,
and 0.1% becomes equal to MIN + 0.1 (MAX - MIN). The default is
Quantile.
$ c3d comp01.png -verbose -pim Quantile -verbose -threshold 75% inf 1 0 Quantile 0.75 maps to 18
$ c3d comp01.png -verbose -pim ForegroundQuantile -verbose -threshold 75% inf 1 0 Foreground quantile 0.75 (over 37467 voxels) maps to 58
$ c3d comp01.png -verbose -pim Range -verbose -threshold 75% inf 1 0 Intensity range spec 0.75 maps to 191.25.
-pim, -percent-intensity-mode: Set behavior of % specifier
Syntax: -pim Quantile | q | ForegroundQuantile | fq | Range | r
This options changes how the percent sign (%) is interpreted when specifying
intensity values. Quantile (q) means that 10% describes the 10th
percentile of all intensity values in the image (i.e., 10% of the voxels
have lower intensity). ForegroundQuantile (fq) is similar, but voxels
with background intensity (see -background option) are excluded from the
percentile computation. Range (r) changes the meaning of percent sign
from percentile to the range between the minimum and maximum of the image,
and 0.1% becomes equal to MIN + 0.1 (MAX - MIN). The default is
Quantile.
$ c3d comp01.png -verbose -pim Quantile -verbose -threshold 75% inf 1 0 Quantile 0.75 maps to 18
$ c3d comp01.png -verbose -pim ForegroundQuantile -verbose -threshold 75% inf 1 0 Foreground quantile 0.75 (over 37467 voxels) maps to 58
$ c3d comp01.png -verbose -pim Range -verbose -threshold 75% inf 1 0 Intensity range spec 0.75 maps to 191.25
5366 def run( 5367 self, 5368 execution: Execution, 5369 ) -> list[str]: 5370 """ 5371 Build command line arguments. This method is called by the main command. 5372 5373 Args: 5374 execution: The execution object. 5375 Returns: 5376 Command line arguments 5377 """ 5378 cargs = [] 5379 cargs.extend([ 5380 "-percent-intensity-mode", 5381 self.percent_intensity_mode 5382 ]) 5383 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5386@dataclasses.dataclass 5387class C3dPixel: 5388 """ 5389 No description found. 5390 """ 5391 pixel: str 5392 """No description found.""" 5393 5394 def run( 5395 self, 5396 execution: Execution, 5397 ) -> list[str]: 5398 """ 5399 Build command line arguments. This method is called by the main command. 5400 5401 Args: 5402 execution: The execution object. 5403 Returns: 5404 Command line arguments 5405 """ 5406 cargs = [] 5407 cargs.extend([ 5408 "-pixel", 5409 self.pixel 5410 ]) 5411 return cargs
No description found.
5394 def run( 5395 self, 5396 execution: Execution, 5397 ) -> list[str]: 5398 """ 5399 Build command line arguments. This method is called by the main command. 5400 5401 Args: 5402 execution: The execution object. 5403 Returns: 5404 Command line arguments 5405 """ 5406 cargs = [] 5407 cargs.extend([ 5408 "-pixel", 5409 self.pixel 5410 ]) 5411 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5414@dataclasses.dataclass 5415class C3dPop: 5416 """ 5417 -pop: Remove last image from the stack 5418 5419 Syntax: `-pop` 5420 5421 Removes the last image from the image stack. Images assigned a name with the 5422 **-as** command will remain in memory. 5423 """ 5424 pop_: str 5425 """-pop: Remove last image from the stack 5426 5427 Syntax: `-pop` 5428 5429 Removes the last image from the image stack. Images assigned a name with the 5430 **-as** command will remain in memory.""" 5431 5432 def run( 5433 self, 5434 execution: Execution, 5435 ) -> list[str]: 5436 """ 5437 Build command line arguments. This method is called by the main command. 5438 5439 Args: 5440 execution: The execution object. 5441 Returns: 5442 Command line arguments 5443 """ 5444 cargs = [] 5445 cargs.extend([ 5446 "-pop", 5447 self.pop_ 5448 ]) 5449 return cargs
-pop: Remove last image from the stack
Syntax: -pop
Removes the last image from the image stack. Images assigned a name with the -as command will remain in memory.
-pop: Remove last image from the stack
Syntax: -pop
Removes the last image from the image stack. Images assigned a name with the -as command will remain in memory.
5432 def run( 5433 self, 5434 execution: Execution, 5435 ) -> list[str]: 5436 """ 5437 Build command line arguments. This method is called by the main command. 5438 5439 Args: 5440 execution: The execution object. 5441 Returns: 5442 Command line arguments 5443 """ 5444 cargs = [] 5445 cargs.extend([ 5446 "-pop", 5447 self.pop_ 5448 ]) 5449 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5452@dataclasses.dataclass 5453class C3dPopas: 5454 """ 5455 -popas: Remove last image from the stack and assign to variable 5456 5457 Syntax: `-popas var` 5458 5459 Removes the last image from the stack, but also assigns it the name 'var', 5460 keeping the image in memory. Same as calling **-as** *var* followed by 5461 **-pop**. 5462 """ 5463 popas: str 5464 """-popas: Remove last image from the stack and assign to variable 5465 5466 Syntax: `-popas var` 5467 5468 Removes the last image from the stack, but also assigns it the name 'var', 5469 keeping the image in memory. Same as calling **-as** *var* followed by 5470 **-pop**.""" 5471 5472 def run( 5473 self, 5474 execution: Execution, 5475 ) -> list[str]: 5476 """ 5477 Build command line arguments. This method is called by the main command. 5478 5479 Args: 5480 execution: The execution object. 5481 Returns: 5482 Command line arguments 5483 """ 5484 cargs = [] 5485 cargs.extend([ 5486 "-popas", 5487 self.popas 5488 ]) 5489 return cargs
-popas: Remove last image from the stack and assign to variable
Syntax: -popas var
Removes the last image from the stack, but also assigns it the name 'var', keeping the image in memory. Same as calling -as var followed by -pop.
-popas: Remove last image from the stack and assign to variable
Syntax: -popas var
Removes the last image from the stack, but also assigns it the name 'var', keeping the image in memory. Same as calling -as var followed by -pop.
5472 def run( 5473 self, 5474 execution: Execution, 5475 ) -> list[str]: 5476 """ 5477 Build command line arguments. This method is called by the main command. 5478 5479 Args: 5480 execution: The execution object. 5481 Returns: 5482 Command line arguments 5483 """ 5484 cargs = [] 5485 cargs.extend([ 5486 "-popas", 5487 self.popas 5488 ]) 5489 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5492@dataclasses.dataclass 5493class C3dProbe: 5494 """ 5495 -probe: Report image intensity at a voxel 5496 5497 Syntax: `-probe <point_spec>` 5498 5499 Prints the value of the image at the position specified by the parameter 5500 `point_spec`, which may be in physical units or voxel units: 5501 5502 c3d img1.img -probe 128x120x160vox 5503 c3d img1.img -interpolation NearestNeighbor -probe 60x60x60mm 5504 c3d img1.img -probe 50%. 5505 """ 5506 probe: str 5507 """-probe: Report image intensity at a voxel 5508 5509 Syntax: `-probe <point_spec>` 5510 5511 Prints the value of the image at the position specified by the parameter 5512 `point_spec`, which may be in physical units or voxel units: 5513 5514 c3d img1.img -probe 128x120x160vox 5515 c3d img1.img -interpolation NearestNeighbor -probe 60x60x60mm 5516 c3d img1.img -probe 50%""" 5517 5518 def run( 5519 self, 5520 execution: Execution, 5521 ) -> list[str]: 5522 """ 5523 Build command line arguments. This method is called by the main command. 5524 5525 Args: 5526 execution: The execution object. 5527 Returns: 5528 Command line arguments 5529 """ 5530 cargs = [] 5531 cargs.extend([ 5532 "-probe", 5533 self.probe 5534 ]) 5535 return cargs
-probe: Report image intensity at a voxel
Syntax: -probe <point_spec>
Prints the value of the image at the position specified by the parameter
point_spec, which may be in physical units or voxel units:
c3d img1.img -probe 128x120x160vox c3d img1.img -interpolation NearestNeighbor -probe 60x60x60mm c3d img1.img -probe 50%.
-probe: Report image intensity at a voxel
Syntax: -probe <point_spec>
Prints the value of the image at the position specified by the parameter
point_spec, which may be in physical units or voxel units:
c3d img1.img -probe 128x120x160vox c3d img1.img -interpolation NearestNeighbor -probe 60x60x60mm c3d img1.img -probe 50%
5518 def run( 5519 self, 5520 execution: Execution, 5521 ) -> list[str]: 5522 """ 5523 Build command line arguments. This method is called by the main command. 5524 5525 Args: 5526 execution: The execution object. 5527 Returns: 5528 Command line arguments 5529 """ 5530 cargs = [] 5531 cargs.extend([ 5532 "-probe", 5533 self.probe 5534 ]) 5535 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5538@dataclasses.dataclass 5539class C3dPush: 5540 """ 5541 -push: Place variable at the end of the stack 5542 5543 Syntax: `-push var` 5544 5545 Places the image associated with variable name 'var' on end of the image 5546 stack. Variable names are assigned using the **-as** command. The **-as** 5547 and **-push** commands are useful when you need to use a certain image more 5548 than once during a convert3d operation. For example, if you want to compute 5549 the distance transform of a binary image and mask it so that the values 5550 outside of the binary image region have value 0, you would use the following 5551 command: 5552 5553 c3d binary.img -as A -sdt -push A -times -o masked_distance.img. 5554 """ 5555 push: str 5556 """-push: Place variable at the end of the stack 5557 5558 Syntax: `-push var` 5559 5560 Places the image associated with variable name 'var' on end of the image 5561 stack. Variable names are assigned using the **-as** command. The **-as** 5562 and **-push** commands are useful when you need to use a certain image more 5563 than once during a convert3d operation. For example, if you want to compute 5564 the distance transform of a binary image and mask it so that the values 5565 outside of the binary image region have value 0, you would use the following 5566 command: 5567 5568 c3d binary.img -as A -sdt -push A -times -o masked_distance.img""" 5569 5570 def run( 5571 self, 5572 execution: Execution, 5573 ) -> list[str]: 5574 """ 5575 Build command line arguments. This method is called by the main command. 5576 5577 Args: 5578 execution: The execution object. 5579 Returns: 5580 Command line arguments 5581 """ 5582 cargs = [] 5583 cargs.extend([ 5584 "-push", 5585 self.push 5586 ]) 5587 return cargs
-push: Place variable at the end of the stack
Syntax: -push var
Places the image associated with variable name 'var' on end of the image stack. Variable names are assigned using the -as command. The -as and -push commands are useful when you need to use a certain image more than once during a convert3d operation. For example, if you want to compute the distance transform of a binary image and mask it so that the values outside of the binary image region have value 0, you would use the following command:
c3d binary.img -as A -sdt -push A -times -o masked_distance.img.
-push: Place variable at the end of the stack
Syntax: -push var
Places the image associated with variable name 'var' on end of the image stack. Variable names are assigned using the -as command. The -as and -push commands are useful when you need to use a certain image more than once during a convert3d operation. For example, if you want to compute the distance transform of a binary image and mask it so that the values outside of the binary image region have value 0, you would use the following command:
c3d binary.img -as A -sdt -push A -times -o masked_distance.img
5570 def run( 5571 self, 5572 execution: Execution, 5573 ) -> list[str]: 5574 """ 5575 Build command line arguments. This method is called by the main command. 5576 5577 Args: 5578 execution: The execution object. 5579 Returns: 5580 Command line arguments 5581 """ 5582 cargs = [] 5583 cargs.extend([ 5584 "-push", 5585 self.push 5586 ]) 5587 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5590@dataclasses.dataclass 5591class C3dRank: 5592 """ 5593 -rank: Voxelwise ranking of intensity values 5594 5595 Syntax: `-rank ` 5596 5597 This command takes N images as the input (all the images on the stack are 5598 used). It also generates N images as the output. For voxel k in image j, it 5599 assigns it a label based on its rank among the values of voxel k in all N 5600 images. If the voxel has highest intensity in image j, then the j'th output 5601 will have value 1. 5602 5603 c3d img1.img img2.img ... imgN.img -rank -oo rank%d.img. 5604 """ 5605 rank: str 5606 """-rank: Voxelwise ranking of intensity values 5607 5608 Syntax: `-rank ` 5609 5610 This command takes N images as the input (all the images on the stack are 5611 used). It also generates N images as the output. For voxel k in image j, it 5612 assigns it a label based on its rank among the values of voxel k in all N 5613 images. If the voxel has highest intensity in image j, then the j'th output 5614 will have value 1. 5615 5616 c3d img1.img img2.img ... imgN.img -rank -oo rank%d.img""" 5617 5618 def run( 5619 self, 5620 execution: Execution, 5621 ) -> list[str]: 5622 """ 5623 Build command line arguments. This method is called by the main command. 5624 5625 Args: 5626 execution: The execution object. 5627 Returns: 5628 Command line arguments 5629 """ 5630 cargs = [] 5631 cargs.extend([ 5632 "-rank", 5633 self.rank 5634 ]) 5635 return cargs
-rank: Voxelwise ranking of intensity values
Syntax: -rank
This command takes N images as the input (all the images on the stack are used). It also generates N images as the output. For voxel k in image j, it assigns it a label based on its rank among the values of voxel k in all N images. If the voxel has highest intensity in image j, then the j'th output will have value 1.
c3d img1.img img2.img ... imgN.img -rank -oo rank%d.img.
-rank: Voxelwise ranking of intensity values
Syntax: -rank
This command takes N images as the input (all the images on the stack are used). It also generates N images as the output. For voxel k in image j, it assigns it a label based on its rank among the values of voxel k in all N images. If the voxel has highest intensity in image j, then the j'th output will have value 1.
c3d img1.img img2.img ... imgN.img -rank -oo rank%d.img
5618 def run( 5619 self, 5620 execution: Execution, 5621 ) -> list[str]: 5622 """ 5623 Build command line arguments. This method is called by the main command. 5624 5625 Args: 5626 execution: The execution object. 5627 Returns: 5628 Command line arguments 5629 """ 5630 cargs = [] 5631 cargs.extend([ 5632 "-rank", 5633 self.rank 5634 ]) 5635 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5638@dataclasses.dataclass 5639class C3dReciprocal: 5640 """ 5641 -reciprocal: Image voxelwise reciprocal 5642 5643 Syntax: `-reciprocal ` 5644 5645 Computes the reciprocal of an image. For instance to compute B = 1 / A, use 5646 the command 5647 5648 c3d A.img -reciprocal -o B.img. 5649 """ 5650 reciprocal: str 5651 """-reciprocal: Image voxelwise reciprocal 5652 5653 Syntax: `-reciprocal ` 5654 5655 Computes the reciprocal of an image. For instance to compute B = 1 / A, use 5656 the command 5657 5658 c3d A.img -reciprocal -o B.img""" 5659 5660 def run( 5661 self, 5662 execution: Execution, 5663 ) -> list[str]: 5664 """ 5665 Build command line arguments. This method is called by the main command. 5666 5667 Args: 5668 execution: The execution object. 5669 Returns: 5670 Command line arguments 5671 """ 5672 cargs = [] 5673 cargs.extend([ 5674 "-reciprocal", 5675 self.reciprocal 5676 ]) 5677 return cargs
-reciprocal: Image voxelwise reciprocal
Syntax: -reciprocal
Computes the reciprocal of an image. For instance to compute B = 1 / A, use the command
c3d A.img -reciprocal -o B.img.
-reciprocal: Image voxelwise reciprocal
Syntax: -reciprocal
Computes the reciprocal of an image. For instance to compute B = 1 / A, use the command
c3d A.img -reciprocal -o B.img
5660 def run( 5661 self, 5662 execution: Execution, 5663 ) -> list[str]: 5664 """ 5665 Build command line arguments. This method is called by the main command. 5666 5667 Args: 5668 execution: The execution object. 5669 Returns: 5670 Command line arguments 5671 """ 5672 cargs = [] 5673 cargs.extend([ 5674 "-reciprocal", 5675 self.reciprocal 5676 ]) 5677 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5680@dataclasses.dataclass 5681class C3dRegion: 5682 """ 5683 -region: Extract region from image 5684 5685 Syntax: `-region vOrigin vSize ` 5686 5687 Extract a rectangular region from the image. The first parameter is the 5688 position of the corner of the region, and the second is the size of the 5689 region. 5690 5691 c3d img1.img -region 20x20x20vox 50x60x70vox -o img2.img 5692 c3d img1.img -region 25% 50% -o img3.img. 5693 """ 5694 region: str 5695 """-region: Extract region from image 5696 5697 Syntax: `-region vOrigin vSize ` 5698 5699 Extract a rectangular region from the image. The first parameter is the 5700 position of the corner of the region, and the second is the size of the 5701 region. 5702 5703 c3d img1.img -region 20x20x20vox 50x60x70vox -o img2.img 5704 c3d img1.img -region 25% 50% -o img3.img""" 5705 5706 def run( 5707 self, 5708 execution: Execution, 5709 ) -> list[str]: 5710 """ 5711 Build command line arguments. This method is called by the main command. 5712 5713 Args: 5714 execution: The execution object. 5715 Returns: 5716 Command line arguments 5717 """ 5718 cargs = [] 5719 cargs.extend([ 5720 "-region", 5721 self.region 5722 ]) 5723 return cargs
-region: Extract region from image
Syntax: -region vOrigin vSize
Extract a rectangular region from the image. The first parameter is the position of the corner of the region, and the second is the size of the region.
c3d img1.img -region 20x20x20vox 50x60x70vox -o img2.img c3d img1.img -region 25% 50% -o img3.img.
-region: Extract region from image
Syntax: -region vOrigin vSize
Extract a rectangular region from the image. The first parameter is the position of the corner of the region, and the second is the size of the region.
c3d img1.img -region 20x20x20vox 50x60x70vox -o img2.img c3d img1.img -region 25% 50% -o img3.img
5706 def run( 5707 self, 5708 execution: Execution, 5709 ) -> list[str]: 5710 """ 5711 Build command line arguments. This method is called by the main command. 5712 5713 Args: 5714 execution: The execution object. 5715 Returns: 5716 Command line arguments 5717 """ 5718 cargs = [] 5719 cargs.extend([ 5720 "-region", 5721 self.region 5722 ]) 5723 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5726@dataclasses.dataclass 5727class C3dReorder: 5728 """ 5729 -reorder: Rearrange images on the stack 5730 5731 Syntax: `-reorder k` or `-reorder fraction` 5732 5733 Rearranges images in the stack, such that images that are k positions apart 5734 become next to each other on the stack. In other words, if the original 5735 order of the images is 1, 2, ..., n, the new order of the images becomes 1, 5736 1+k, 1+2k, ..., 2, 2+k, 2+2k, ..., k, 2k, ... n. Of course, n must be 5737 divisible by k. As an alternative to specifying k, you can specify a 5738 floating point number (i.e., **-reorder** 0.5), in which case k is obtained 5739 by multiplying n by the floating point number and rounding to the nearest 5740 integer. 5741 5742 The following three commands are equivalent: 5743 5744 c3d a1.nii a2.nii a3.nii a4.nii b1.nii b2.nii b3.nii b4.nii -reorder 4 ... 5745 c3d a1.nii a2.nii a3.nii a4.nii b1.nii b2.nii b3.nii b4.nii -reorder 0.5 ... 5746 c3d a1.nii b1.nii a2.nii b2.nii a3.nii b3.nii a4.nii b4.nii ... 5747 5748 The **-reorder** command us useful when you specify two sets of images using 5749 wildcards and then want to perform pairwise operations on the images. For 5750 example 5751 5752 c3d weight*.nii gray*.nii -reorder 0.5 -weighted-sum-voxelwise -o wsum.nii 5753 5754 is equivalent to the command 5755 5756 c3d weight1.nii gray1.nii weight2.nii gray2.nii ... -weighted-sum-voxelwise 5757 -o wsum.nii. 5758 """ 5759 reorder: str 5760 """-reorder: Rearrange images on the stack 5761 5762 Syntax: `-reorder k` or `-reorder fraction` 5763 5764 Rearranges images in the stack, such that images that are k positions apart 5765 become next to each other on the stack. In other words, if the original 5766 order of the images is 1, 2, ..., n, the new order of the images becomes 1, 5767 1+k, 1+2k, ..., 2, 2+k, 2+2k, ..., k, 2k, ... n. Of course, n must be 5768 divisible by k. As an alternative to specifying k, you can specify a 5769 floating point number (i.e., **-reorder** 0.5), in which case k is obtained 5770 by multiplying n by the floating point number and rounding to the nearest 5771 integer. 5772 5773 The following three commands are equivalent: 5774 5775 c3d a1.nii a2.nii a3.nii a4.nii b1.nii b2.nii b3.nii b4.nii -reorder 4 ... 5776 c3d a1.nii a2.nii a3.nii a4.nii b1.nii b2.nii b3.nii b4.nii -reorder 0.5 ... 5777 c3d a1.nii b1.nii a2.nii b2.nii a3.nii b3.nii a4.nii b4.nii ... 5778 5779 The **-reorder** command us useful when you specify two sets of images using 5780 wildcards and then want to perform pairwise operations on the images. For 5781 example 5782 5783 c3d weight*.nii gray*.nii -reorder 0.5 -weighted-sum-voxelwise -o wsum.nii 5784 5785 is equivalent to the command 5786 5787 c3d weight1.nii gray1.nii weight2.nii gray2.nii ... -weighted-sum-voxelwise 5788 -o wsum.nii""" 5789 5790 def run( 5791 self, 5792 execution: Execution, 5793 ) -> list[str]: 5794 """ 5795 Build command line arguments. This method is called by the main command. 5796 5797 Args: 5798 execution: The execution object. 5799 Returns: 5800 Command line arguments 5801 """ 5802 cargs = [] 5803 cargs.extend([ 5804 "-reorder", 5805 self.reorder 5806 ]) 5807 return cargs
-reorder: Rearrange images on the stack
Syntax: -reorder k or -reorder fraction
Rearranges images in the stack, such that images that are k positions apart become next to each other on the stack. In other words, if the original order of the images is 1, 2, ..., n, the new order of the images becomes 1, 1+k, 1+2k, ..., 2, 2+k, 2+2k, ..., k, 2k, ... n. Of course, n must be divisible by k. As an alternative to specifying k, you can specify a floating point number (i.e., -reorder 0.5), in which case k is obtained by multiplying n by the floating point number and rounding to the nearest integer.
The following three commands are equivalent:
c3d a1.nii a2.nii a3.nii a4.nii b1.nii b2.nii b3.nii b4.nii -reorder 4 ... c3d a1.nii a2.nii a3.nii a4.nii b1.nii b2.nii b3.nii b4.nii -reorder 0.5 ... c3d a1.nii b1.nii a2.nii b2.nii a3.nii b3.nii a4.nii b4.nii ...
The -reorder command us useful when you specify two sets of images using wildcards and then want to perform pairwise operations on the images. For example
c3d weight.nii gray.nii -reorder 0.5 -weighted-sum-voxelwise -o wsum.nii
is equivalent to the command
c3d weight1.nii gray1.nii weight2.nii gray2.nii ... -weighted-sum-voxelwise -o wsum.nii.
-reorder: Rearrange images on the stack
Syntax: -reorder k or -reorder fraction
Rearranges images in the stack, such that images that are k positions apart become next to each other on the stack. In other words, if the original order of the images is 1, 2, ..., n, the new order of the images becomes 1, 1+k, 1+2k, ..., 2, 2+k, 2+2k, ..., k, 2k, ... n. Of course, n must be divisible by k. As an alternative to specifying k, you can specify a floating point number (i.e., -reorder 0.5), in which case k is obtained by multiplying n by the floating point number and rounding to the nearest integer.
The following three commands are equivalent:
c3d a1.nii a2.nii a3.nii a4.nii b1.nii b2.nii b3.nii b4.nii -reorder 4 ... c3d a1.nii a2.nii a3.nii a4.nii b1.nii b2.nii b3.nii b4.nii -reorder 0.5 ... c3d a1.nii b1.nii a2.nii b2.nii a3.nii b3.nii a4.nii b4.nii ...
The -reorder command us useful when you specify two sets of images using wildcards and then want to perform pairwise operations on the images. For example
c3d weight.nii gray.nii -reorder 0.5 -weighted-sum-voxelwise -o wsum.nii
is equivalent to the command
c3d weight1.nii gray1.nii weight2.nii gray2.nii ... -weighted-sum-voxelwise -o wsum.nii
5790 def run( 5791 self, 5792 execution: Execution, 5793 ) -> list[str]: 5794 """ 5795 Build command line arguments. This method is called by the main command. 5796 5797 Args: 5798 execution: The execution object. 5799 Returns: 5800 Command line arguments 5801 """ 5802 cargs = [] 5803 cargs.extend([ 5804 "-reorder", 5805 self.reorder 5806 ]) 5807 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6244@dataclasses.dataclass 6245class C3dReplace: 6246 """ 6247 -replace: Replace intensities in image 6248 6249 Syntax: `-replace I1 J1 I2 J2 ... ` 6250 6251 Replace intensity I1 by J1, I2 by J2 and so on. Allowed values of intensity 6252 include **nan**, **inf** and **-inf**. 6253 6254 c3d img1.img -replace 1 128 nan 0.0 -o img2.img. 6255 """ 6256 replace: str 6257 """-replace: Replace intensities in image 6258 6259 Syntax: `-replace I1 J1 I2 J2 ... ` 6260 6261 Replace intensity I1 by J1, I2 by J2 and so on. Allowed values of intensity 6262 include **nan**, **inf** and **-inf**. 6263 6264 c3d img1.img -replace 1 128 nan 0.0 -o img2.img""" 6265 6266 def run( 6267 self, 6268 execution: Execution, 6269 ) -> list[str]: 6270 """ 6271 Build command line arguments. This method is called by the main command. 6272 6273 Args: 6274 execution: The execution object. 6275 Returns: 6276 Command line arguments 6277 """ 6278 cargs = [] 6279 cargs.extend([ 6280 "-replace", 6281 self.replace 6282 ]) 6283 return cargs
-replace: Replace intensities in image
Syntax: -replace I1 J1 I2 J2 ...
Replace intensity I1 by J1, I2 by J2 and so on. Allowed values of intensity include nan, inf and -inf.
c3d img1.img -replace 1 128 nan 0.0 -o img2.img.
-replace: Replace intensities in image
Syntax: -replace I1 J1 I2 J2 ...
Replace intensity I1 by J1, I2 by J2 and so on. Allowed values of intensity include nan, inf and -inf.
c3d img1.img -replace 1 128 nan 0.0 -o img2.img
6266 def run( 6267 self, 6268 execution: Execution, 6269 ) -> list[str]: 6270 """ 6271 Build command line arguments. This method is called by the main command. 6272 6273 Args: 6274 execution: The execution object. 6275 Returns: 6276 Command line arguments 6277 """ 6278 cargs = [] 6279 cargs.extend([ 6280 "-replace", 6281 self.replace 6282 ]) 6283 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6286@dataclasses.dataclass 6287class C3dResample: 6288 """ 6289 -resample: Resample image to new dimensions 6290 6291 Syntax: `-resample <dimensions> ` 6292 6293 Resamples the image, keeping the bounding box the same, but changing the 6294 number of voxels in the image. The dimensions can be specified as a 6295 percentage, for example to double the number of voxels in each direction. 6296 The **-interpolation** flag affects how sampling is performed. 6297 6298 c3d img1.img -resample 123x142x200 -o img2.img 6299 c3d img1.img -resample 200% -o img2.img 6300 c3d img1.img -resample 100x100x200% -o img2.img 6301 c3d img1.img -background 4.0 -interpolation Cubic -resample 123x142x200 -o 6302 img2.img. 6303 """ 6304 resample: str 6305 """-resample: Resample image to new dimensions 6306 6307 Syntax: `-resample <dimensions> ` 6308 6309 Resamples the image, keeping the bounding box the same, but changing the 6310 number of voxels in the image. The dimensions can be specified as a 6311 percentage, for example to double the number of voxels in each direction. 6312 The **-interpolation** flag affects how sampling is performed. 6313 6314 c3d img1.img -resample 123x142x200 -o img2.img 6315 c3d img1.img -resample 200% -o img2.img 6316 c3d img1.img -resample 100x100x200% -o img2.img 6317 c3d img1.img -background 4.0 -interpolation Cubic -resample 123x142x200 -o 6318 img2.img""" 6319 6320 def run( 6321 self, 6322 execution: Execution, 6323 ) -> list[str]: 6324 """ 6325 Build command line arguments. This method is called by the main command. 6326 6327 Args: 6328 execution: The execution object. 6329 Returns: 6330 Command line arguments 6331 """ 6332 cargs = [] 6333 cargs.extend([ 6334 "-resample", 6335 self.resample 6336 ]) 6337 return cargs
-resample: Resample image to new dimensions
Syntax: -resample <dimensions>
Resamples the image, keeping the bounding box the same, but changing the number of voxels in the image. The dimensions can be specified as a percentage, for example to double the number of voxels in each direction. The -interpolation flag affects how sampling is performed.
c3d img1.img -resample 123x142x200 -o img2.img c3d img1.img -resample 200% -o img2.img c3d img1.img -resample 100x100x200% -o img2.img c3d img1.img -background 4.0 -interpolation Cubic -resample 123x142x200 -o img2.img.
-resample: Resample image to new dimensions
Syntax: -resample <dimensions>
Resamples the image, keeping the bounding box the same, but changing the number of voxels in the image. The dimensions can be specified as a percentage, for example to double the number of voxels in each direction. The -interpolation flag affects how sampling is performed.
c3d img1.img -resample 123x142x200 -o img2.img c3d img1.img -resample 200% -o img2.img c3d img1.img -resample 100x100x200% -o img2.img c3d img1.img -background 4.0 -interpolation Cubic -resample 123x142x200 -o img2.img
6320 def run( 6321 self, 6322 execution: Execution, 6323 ) -> list[str]: 6324 """ 6325 Build command line arguments. This method is called by the main command. 6326 6327 Args: 6328 execution: The execution object. 6329 Returns: 6330 Command line arguments 6331 """ 6332 cargs = [] 6333 cargs.extend([ 6334 "-resample", 6335 self.resample 6336 ]) 6337 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6340@dataclasses.dataclass 6341class C3dResampleIso: 6342 """ 6343 -resample-iso: Resample image to (approximately) isotropic resolution 6344 6345 Syntax: `-resample-iso <min|max>` 6346 6347 Resamples the image to have approximately isotropic resolution, either based 6348 on the smallest voxel dimension ('min' mode) or largest voxel dimension 6349 ('max' mode). This command calls **-resample** with appropriately calculated 6350 new image dimensions. The bounding box of the image in physical space is 6351 preserved. Therefore, since the image dimensions must be integer, the actual 6352 voxel dimensions after resampling may not be precisely isotropic. 6353 6354 c3d img1.img -resample-iso min -o img2.img. 6355 """ 6356 resample_iso: str 6357 """-resample-iso: Resample image to (approximately) isotropic resolution 6358 6359 Syntax: `-resample-iso <min|max>` 6360 6361 Resamples the image to have approximately isotropic resolution, either based 6362 on the smallest voxel dimension ('min' mode) or largest voxel dimension 6363 ('max' mode). This command calls **-resample** with appropriately calculated 6364 new image dimensions. The bounding box of the image in physical space is 6365 preserved. Therefore, since the image dimensions must be integer, the actual 6366 voxel dimensions after resampling may not be precisely isotropic. 6367 6368 c3d img1.img -resample-iso min -o img2.img""" 6369 6370 def run( 6371 self, 6372 execution: Execution, 6373 ) -> list[str]: 6374 """ 6375 Build command line arguments. This method is called by the main command. 6376 6377 Args: 6378 execution: The execution object. 6379 Returns: 6380 Command line arguments 6381 """ 6382 cargs = [] 6383 cargs.extend([ 6384 "-resample-iso", 6385 self.resample_iso 6386 ]) 6387 return cargs
-resample-iso: Resample image to (approximately) isotropic resolution
Syntax: -resample-iso <min|max>
Resamples the image to have approximately isotropic resolution, either based on the smallest voxel dimension ('min' mode) or largest voxel dimension ('max' mode). This command calls -resample with appropriately calculated new image dimensions. The bounding box of the image in physical space is preserved. Therefore, since the image dimensions must be integer, the actual voxel dimensions after resampling may not be precisely isotropic.
c3d img1.img -resample-iso min -o img2.img.
-resample-iso: Resample image to (approximately) isotropic resolution
Syntax: -resample-iso <min|max>
Resamples the image to have approximately isotropic resolution, either based on the smallest voxel dimension ('min' mode) or largest voxel dimension ('max' mode). This command calls -resample with appropriately calculated new image dimensions. The bounding box of the image in physical space is preserved. Therefore, since the image dimensions must be integer, the actual voxel dimensions after resampling may not be precisely isotropic.
c3d img1.img -resample-iso min -o img2.img
6370 def run( 6371 self, 6372 execution: Execution, 6373 ) -> list[str]: 6374 """ 6375 Build command line arguments. This method is called by the main command. 6376 6377 Args: 6378 execution: The execution object. 6379 Returns: 6380 Command line arguments 6381 """ 6382 cargs = [] 6383 cargs.extend([ 6384 "-resample-iso", 6385 self.resample_iso 6386 ]) 6387 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6390@dataclasses.dataclass 6391class C3dResampleMm: 6392 """ 6393 -resample-mm: Resample image to new resolution 6394 6395 Syntax: `-resample-mm <voxel_size> ` 6396 6397 Resamples the image as in **-resample**, but the user specifies the new 6398 voxel size rather than dimensions. This may not be precise, so the bounding 6399 box of the image may change. A warning will be generated in that case. 6400 6401 c3d img1.img -resample-mm 1.0x1.5x1.5mm -o img2.img. 6402 """ 6403 resample_mm: str 6404 """-resample-mm: Resample image to new resolution 6405 6406 Syntax: `-resample-mm <voxel_size> ` 6407 6408 Resamples the image as in **-resample**, but the user specifies the new 6409 voxel size rather than dimensions. This may not be precise, so the bounding 6410 box of the image may change. A warning will be generated in that case. 6411 6412 c3d img1.img -resample-mm 1.0x1.5x1.5mm -o img2.img""" 6413 6414 def run( 6415 self, 6416 execution: Execution, 6417 ) -> list[str]: 6418 """ 6419 Build command line arguments. This method is called by the main command. 6420 6421 Args: 6422 execution: The execution object. 6423 Returns: 6424 Command line arguments 6425 """ 6426 cargs = [] 6427 cargs.extend([ 6428 "-resample-mm", 6429 self.resample_mm 6430 ]) 6431 return cargs
-resample-mm: Resample image to new resolution
Syntax: -resample-mm <voxel_size>
Resamples the image as in -resample, but the user specifies the new voxel size rather than dimensions. This may not be precise, so the bounding box of the image may change. A warning will be generated in that case.
c3d img1.img -resample-mm 1.0x1.5x1.5mm -o img2.img.
-resample-mm: Resample image to new resolution
Syntax: -resample-mm <voxel_size>
Resamples the image as in -resample, but the user specifies the new voxel size rather than dimensions. This may not be precise, so the bounding box of the image may change. A warning will be generated in that case.
c3d img1.img -resample-mm 1.0x1.5x1.5mm -o img2.img
6414 def run( 6415 self, 6416 execution: Execution, 6417 ) -> list[str]: 6418 """ 6419 Build command line arguments. This method is called by the main command. 6420 6421 Args: 6422 execution: The execution object. 6423 Returns: 6424 Command line arguments 6425 """ 6426 cargs = [] 6427 cargs.extend([ 6428 "-resample-mm", 6429 self.resample_mm 6430 ]) 6431 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6500@dataclasses.dataclass 6501class C3dResliceIdentity: 6502 """ 6503 -reslice-identity: Resample image using identity transform 6504 6505 Syntax: `-reslice-identity ` 6506 6507 Applies the **-reslice-matrix** command with the identity transform. This is 6508 useful when you have two scans of the same subject with different coordinate 6509 transformations to patient space and you want to resample one scan in the 6510 space of another scan. For example, if you have T1 and T2 images in 6511 different coordinate frames, and want to reslice the T2 image into the space 6512 of the T1 6513 6514 c3d t1.nii t2.nii -reslice-identity -o t2_in_t1_space.nii. 6515 """ 6516 reslice_identity: str 6517 """-reslice-identity: Resample image using identity transform 6518 6519 Syntax: `-reslice-identity ` 6520 6521 Applies the **-reslice-matrix** command with the identity transform. This is 6522 useful when you have two scans of the same subject with different coordinate 6523 transformations to patient space and you want to resample one scan in the 6524 space of another scan. For example, if you have T1 and T2 images in 6525 different coordinate frames, and want to reslice the T2 image into the space 6526 of the T1 6527 6528 c3d t1.nii t2.nii -reslice-identity -o t2_in_t1_space.nii""" 6529 6530 def run( 6531 self, 6532 execution: Execution, 6533 ) -> list[str]: 6534 """ 6535 Build command line arguments. This method is called by the main command. 6536 6537 Args: 6538 execution: The execution object. 6539 Returns: 6540 Command line arguments 6541 """ 6542 cargs = [] 6543 cargs.extend([ 6544 "-reslice-identity", 6545 self.reslice_identity 6546 ]) 6547 return cargs
-reslice-identity: Resample image using identity transform
Syntax: -reslice-identity
Applies the -reslice-matrix command with the identity transform. This is useful when you have two scans of the same subject with different coordinate transformations to patient space and you want to resample one scan in the space of another scan. For example, if you have T1 and T2 images in different coordinate frames, and want to reslice the T2 image into the space of the T1
c3d t1.nii t2.nii -reslice-identity -o t2_in_t1_space.nii.
-reslice-identity: Resample image using identity transform
Syntax: -reslice-identity
Applies the -reslice-matrix command with the identity transform. This is useful when you have two scans of the same subject with different coordinate transformations to patient space and you want to resample one scan in the space of another scan. For example, if you have T1 and T2 images in different coordinate frames, and want to reslice the T2 image into the space of the T1
c3d t1.nii t2.nii -reslice-identity -o t2_in_t1_space.nii
6530 def run( 6531 self, 6532 execution: Execution, 6533 ) -> list[str]: 6534 """ 6535 Build command line arguments. This method is called by the main command. 6536 6537 Args: 6538 execution: The execution object. 6539 Returns: 6540 Command line arguments 6541 """ 6542 cargs = [] 6543 cargs.extend([ 6544 "-reslice-identity", 6545 self.reslice_identity 6546 ]) 6547 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6434@dataclasses.dataclass 6435class C3dResliceItk: 6436 """ 6437 -reslice-itk: Resample image using affine transform 6438 6439 Syntax: `-reslice-itk <transform_file> ` 6440 6441 Applies affine (or other) transform in ITK (ANTs) format to an image. See 6442 notes to **-reslice-matrix** for usage. 6443 """ 6444 reslice_itk: str 6445 """-reslice-itk: Resample image using affine transform 6446 6447 Syntax: `-reslice-itk <transform_file> ` 6448 6449 Applies affine (or other) transform in ITK (ANTs) format to an image. See 6450 notes to **-reslice-matrix** for usage.""" 6451 6452 def run( 6453 self, 6454 execution: Execution, 6455 ) -> list[str]: 6456 """ 6457 Build command line arguments. This method is called by the main command. 6458 6459 Args: 6460 execution: The execution object. 6461 Returns: 6462 Command line arguments 6463 """ 6464 cargs = [] 6465 cargs.extend([ 6466 "-reslice-itk", 6467 self.reslice_itk 6468 ]) 6469 return cargs
-reslice-itk: Resample image using affine transform
Syntax: -reslice-itk <transform_file>
Applies affine (or other) transform in ITK (ANTs) format to an image. See notes to -reslice-matrix for usage.
-reslice-itk: Resample image using affine transform
Syntax: -reslice-itk <transform_file>
Applies affine (or other) transform in ITK (ANTs) format to an image. See notes to -reslice-matrix for usage.
6452 def run( 6453 self, 6454 execution: Execution, 6455 ) -> list[str]: 6456 """ 6457 Build command line arguments. This method is called by the main command. 6458 6459 Args: 6460 execution: The execution object. 6461 Returns: 6462 Command line arguments 6463 """ 6464 cargs = [] 6465 cargs.extend([ 6466 "-reslice-itk", 6467 self.reslice_itk 6468 ]) 6469 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6472@dataclasses.dataclass 6473class C3dResliceMatrix: 6474 """ 6475 No description found. 6476 """ 6477 reslice_matrix: str 6478 """No description found.""" 6479 6480 def run( 6481 self, 6482 execution: Execution, 6483 ) -> list[str]: 6484 """ 6485 Build command line arguments. This method is called by the main command. 6486 6487 Args: 6488 execution: The execution object. 6489 Returns: 6490 Command line arguments 6491 """ 6492 cargs = [] 6493 cargs.extend([ 6494 "-reslice-matrix", 6495 self.reslice_matrix 6496 ]) 6497 return cargs
No description found.
6480 def run( 6481 self, 6482 execution: Execution, 6483 ) -> list[str]: 6484 """ 6485 Build command line arguments. This method is called by the main command. 6486 6487 Args: 6488 execution: The execution object. 6489 Returns: 6490 Command line arguments 6491 """ 6492 cargs = [] 6493 cargs.extend([ 6494 "-reslice-matrix", 6495 self.reslice_matrix 6496 ]) 6497 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5810@dataclasses.dataclass 5811class C3dRetainLabels: 5812 """ 5813 -retain-labels: Retain labels in a label image 5814 5815 Syntax: `-retain-labels I1 I2 ... IN` 5816 5817 Assuming that the input is a multi-label segmentation image, this command 5818 keeps all labels specifed in the list and replaces the remaining labels with 5819 the background value. 5820 5821 c3d seg.nii -retain-labels 2 3 4 8 -o subseg.nii. 5822 """ 5823 retain_labels: str 5824 """-retain-labels: Retain labels in a label image 5825 5826 Syntax: `-retain-labels I1 I2 ... IN` 5827 5828 Assuming that the input is a multi-label segmentation image, this command 5829 keeps all labels specifed in the list and replaces the remaining labels with 5830 the background value. 5831 5832 c3d seg.nii -retain-labels 2 3 4 8 -o subseg.nii""" 5833 5834 def run( 5835 self, 5836 execution: Execution, 5837 ) -> list[str]: 5838 """ 5839 Build command line arguments. This method is called by the main command. 5840 5841 Args: 5842 execution: The execution object. 5843 Returns: 5844 Command line arguments 5845 """ 5846 cargs = [] 5847 cargs.extend([ 5848 "-retain-labels", 5849 self.retain_labels 5850 ]) 5851 return cargs
-retain-labels: Retain labels in a label image
Syntax: -retain-labels I1 I2 ... IN
Assuming that the input is a multi-label segmentation image, this command keeps all labels specifed in the list and replaces the remaining labels with the background value.
c3d seg.nii -retain-labels 2 3 4 8 -o subseg.nii.
-retain-labels: Retain labels in a label image
Syntax: -retain-labels I1 I2 ... IN
Assuming that the input is a multi-label segmentation image, this command keeps all labels specifed in the list and replaces the remaining labels with the background value.
c3d seg.nii -retain-labels 2 3 4 8 -o subseg.nii
5834 def run( 5835 self, 5836 execution: Execution, 5837 ) -> list[str]: 5838 """ 5839 Build command line arguments. This method is called by the main command. 5840 5841 Args: 5842 execution: The execution object. 5843 Returns: 5844 Command line arguments 5845 """ 5846 cargs = [] 5847 cargs.extend([ 5848 "-retain-labels", 5849 self.retain_labels 5850 ]) 5851 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5854@dataclasses.dataclass 5855class C3dRfApply: 5856 """ 5857 -rf-apply: Apply Random Forest classifier 5858 5859 Syntax: `-rf-apply <classifier_file>` 5860 5861 This command applies a classifier trained previously by **-rf-train**. The 5862 stack must contain the same number of feature images as when training. The 5863 images will be removed from the stack and replaced with a set of K 5864 probability images, where K is the number of classes during training. See 5865 examples under **-rf-train** for usage. 5866 """ 5867 rf_apply: str 5868 """-rf-apply: Apply Random Forest classifier 5869 5870 Syntax: `-rf-apply <classifier_file>` 5871 5872 This command applies a classifier trained previously by **-rf-train**. The 5873 stack must contain the same number of feature images as when training. The 5874 images will be removed from the stack and replaced with a set of K 5875 probability images, where K is the number of classes during training. See 5876 examples under **-rf-train** for usage.""" 5877 5878 def run( 5879 self, 5880 execution: Execution, 5881 ) -> list[str]: 5882 """ 5883 Build command line arguments. This method is called by the main command. 5884 5885 Args: 5886 execution: The execution object. 5887 Returns: 5888 Command line arguments 5889 """ 5890 cargs = [] 5891 cargs.extend([ 5892 "-rf-apply", 5893 self.rf_apply 5894 ]) 5895 return cargs
-rf-apply: Apply Random Forest classifier
Syntax: -rf-apply <classifier_file>
This command applies a classifier trained previously by -rf-train. The stack must contain the same number of feature images as when training. The images will be removed from the stack and replaced with a set of K probability images, where K is the number of classes during training. See examples under -rf-train for usage.
-rf-apply: Apply Random Forest classifier
Syntax: -rf-apply <classifier_file>
This command applies a classifier trained previously by -rf-train. The stack must contain the same number of feature images as when training. The images will be removed from the stack and replaced with a set of K probability images, where K is the number of classes during training. See examples under -rf-train for usage.
5878 def run( 5879 self, 5880 execution: Execution, 5881 ) -> list[str]: 5882 """ 5883 Build command line arguments. This method is called by the main command. 5884 5885 Args: 5886 execution: The execution object. 5887 Returns: 5888 Command line arguments 5889 """ 5890 cargs = [] 5891 cargs.extend([ 5892 "-rf-apply", 5893 self.rf_apply 5894 ]) 5895 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6102@dataclasses.dataclass 6103class C3dRfParamNousexyz: 6104 """ 6105 No description found. 6106 """ 6107 rf_param_nousexyz: str 6108 """No description found.""" 6109 6110 def run( 6111 self, 6112 execution: Execution, 6113 ) -> list[str]: 6114 """ 6115 Build command line arguments. This method is called by the main command. 6116 6117 Args: 6118 execution: The execution object. 6119 Returns: 6120 Command line arguments 6121 """ 6122 cargs = [] 6123 cargs.extend([ 6124 "-rf-param-nousexyz", 6125 self.rf_param_nousexyz 6126 ]) 6127 return cargs
No description found.
6110 def run( 6111 self, 6112 execution: Execution, 6113 ) -> list[str]: 6114 """ 6115 Build command line arguments. This method is called by the main command. 6116 6117 Args: 6118 execution: The execution object. 6119 Returns: 6120 Command line arguments 6121 """ 6122 cargs = [] 6123 cargs.extend([ 6124 "-rf-param-nousexyz", 6125 self.rf_param_nousexyz 6126 ]) 6127 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6130@dataclasses.dataclass 6131class C3dRfParamNtrees: 6132 """ 6133 -rf-param-ntrees: Random Forest forest size 6134 6135 Syntax: `-rf-param-ntrees <integer>` 6136 6137 Sets the number of trees in the forest. Default value is 50. Larger forests 6138 are more robust but more time to train and apply. 6139 """ 6140 rf_param_ntrees: str 6141 """-rf-param-ntrees: Random Forest forest size 6142 6143 Syntax: `-rf-param-ntrees <integer>` 6144 6145 Sets the number of trees in the forest. Default value is 50. Larger forests 6146 are more robust but more time to train and apply.""" 6147 6148 def run( 6149 self, 6150 execution: Execution, 6151 ) -> list[str]: 6152 """ 6153 Build command line arguments. This method is called by the main command. 6154 6155 Args: 6156 execution: The execution object. 6157 Returns: 6158 Command line arguments 6159 """ 6160 cargs = [] 6161 cargs.extend([ 6162 "-rf-param-ntrees", 6163 self.rf_param_ntrees 6164 ]) 6165 return cargs
-rf-param-ntrees: Random Forest forest size
Syntax: -rf-param-ntrees <integer>
Sets the number of trees in the forest. Default value is 50. Larger forests are more robust but more time to train and apply.
-rf-param-ntrees: Random Forest forest size
Syntax: -rf-param-ntrees <integer>
Sets the number of trees in the forest. Default value is 50. Larger forests are more robust but more time to train and apply.
6148 def run( 6149 self, 6150 execution: Execution, 6151 ) -> list[str]: 6152 """ 6153 Build command line arguments. This method is called by the main command. 6154 6155 Args: 6156 execution: The execution object. 6157 Returns: 6158 Command line arguments 6159 """ 6160 cargs = [] 6161 cargs.extend([ 6162 "-rf-param-ntrees", 6163 self.rf_param_ntrees 6164 ]) 6165 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6010@dataclasses.dataclass 6011class C3dRfParamPatch: 6012 """ 6013 -rf-param-patch: Random Forest training patch size 6014 6015 Syntax: `-rf-param-patch <size_spec>` 6016 6017 Set the radius of the patch used to generate features for the RF classifier. 6018 By default this is zero, which means that just the intensity of each voxel 6019 is used as a feature. Setting this to non-zero values will result in 6020 neighboring intensities also being used as features, and can improve 6021 classification in presence of complex image texture. The patch size in each 6022 dimension is (2 * radius + 1). See **-rf-train** command for details. 6023 6024 # Set patch size to 5x5x5 6025 c3d ... -rf-param-patch 2x2x2 ... -rf-train myforest.rf. 6026 """ 6027 rf_param_patch: str 6028 """-rf-param-patch: Random Forest training patch size 6029 6030 Syntax: `-rf-param-patch <size_spec>` 6031 6032 Set the radius of the patch used to generate features for the RF classifier. 6033 By default this is zero, which means that just the intensity of each voxel 6034 is used as a feature. Setting this to non-zero values will result in 6035 neighboring intensities also being used as features, and can improve 6036 classification in presence of complex image texture. The patch size in each 6037 dimension is (2 * radius + 1). See **-rf-train** command for details. 6038 6039 # Set patch size to 5x5x5 6040 c3d ... -rf-param-patch 2x2x2 ... -rf-train myforest.rf""" 6041 6042 def run( 6043 self, 6044 execution: Execution, 6045 ) -> list[str]: 6046 """ 6047 Build command line arguments. This method is called by the main command. 6048 6049 Args: 6050 execution: The execution object. 6051 Returns: 6052 Command line arguments 6053 """ 6054 cargs = [] 6055 cargs.extend([ 6056 "-rf-param-patch", 6057 self.rf_param_patch 6058 ]) 6059 return cargs
-rf-param-patch: Random Forest training patch size
Syntax: -rf-param-patch <size_spec>
Set the radius of the patch used to generate features for the RF classifier. By default this is zero, which means that just the intensity of each voxel is used as a feature. Setting this to non-zero values will result in neighboring intensities also being used as features, and can improve classification in presence of complex image texture. The patch size in each dimension is (2 * radius + 1). See -rf-train command for details.
Set patch size to 5x5x5
c3d ... -rf-param-patch 2x2x2 ... -rf-train myforest.rf.
-rf-param-patch: Random Forest training patch size
Syntax: -rf-param-patch <size_spec>
Set the radius of the patch used to generate features for the RF classifier. By default this is zero, which means that just the intensity of each voxel is used as a feature. Setting this to non-zero values will result in neighboring intensities also being used as features, and can improve classification in presence of complex image texture. The patch size in each dimension is (2 * radius + 1). See -rf-train command for details.
Set patch size to 5x5x5
c3d ... -rf-param-patch 2x2x2 ... -rf-train myforest.rf
6042 def run( 6043 self, 6044 execution: Execution, 6045 ) -> list[str]: 6046 """ 6047 Build command line arguments. This method is called by the main command. 6048 6049 Args: 6050 execution: The execution object. 6051 Returns: 6052 Command line arguments 6053 """ 6054 cargs = [] 6055 cargs.extend([ 6056 "-rf-param-patch", 6057 self.rf_param_patch 6058 ]) 6059 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6168@dataclasses.dataclass 6169class C3dRfParamTreedepth: 6170 """ 6171 -rf-param-treedepth: Random Forest tree depth 6172 6173 Syntax: `-rf-param-treedepth <integer>` 6174 6175 Sets the depth of the trees in the classifier. Default value is 30. Deeper 6176 trees can learn on more complex data but require more time. 6177 """ 6178 rf_param_treedepth: str 6179 """-rf-param-treedepth: Random Forest tree depth 6180 6181 Syntax: `-rf-param-treedepth <integer>` 6182 6183 Sets the depth of the trees in the classifier. Default value is 30. Deeper 6184 trees can learn on more complex data but require more time.""" 6185 6186 def run( 6187 self, 6188 execution: Execution, 6189 ) -> list[str]: 6190 """ 6191 Build command line arguments. This method is called by the main command. 6192 6193 Args: 6194 execution: The execution object. 6195 Returns: 6196 Command line arguments 6197 """ 6198 cargs = [] 6199 cargs.extend([ 6200 "-rf-param-treedepth", 6201 self.rf_param_treedepth 6202 ]) 6203 return cargs
-rf-param-treedepth: Random Forest tree depth
Syntax: -rf-param-treedepth <integer>
Sets the depth of the trees in the classifier. Default value is 30. Deeper trees can learn on more complex data but require more time.
-rf-param-treedepth: Random Forest tree depth
Syntax: -rf-param-treedepth <integer>
Sets the depth of the trees in the classifier. Default value is 30. Deeper trees can learn on more complex data but require more time.
6186 def run( 6187 self, 6188 execution: Execution, 6189 ) -> list[str]: 6190 """ 6191 Build command line arguments. This method is called by the main command. 6192 6193 Args: 6194 execution: The execution object. 6195 Returns: 6196 Command line arguments 6197 """ 6198 cargs = [] 6199 cargs.extend([ 6200 "-rf-param-treedepth", 6201 self.rf_param_treedepth 6202 ]) 6203 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6062@dataclasses.dataclass 6063class C3dRfParamUsexyz: 6064 """ 6065 -rf-param-usexyz: Random Forest coordinate features 6066 6067 Syntax: `-rf-param-usexyz` 6068 6069 Use the coordinates of voxels as additional features. This allows some 6070 geometric relations between different labels to be learned. Equivalent to 6071 the corresponding ITK-SNAP option. 6072 """ 6073 rf_param_usexyz: str 6074 """-rf-param-usexyz: Random Forest coordinate features 6075 6076 Syntax: `-rf-param-usexyz` 6077 6078 Use the coordinates of voxels as additional features. This allows some 6079 geometric relations between different labels to be learned. Equivalent to 6080 the corresponding ITK-SNAP option.""" 6081 6082 def run( 6083 self, 6084 execution: Execution, 6085 ) -> list[str]: 6086 """ 6087 Build command line arguments. This method is called by the main command. 6088 6089 Args: 6090 execution: The execution object. 6091 Returns: 6092 Command line arguments 6093 """ 6094 cargs = [] 6095 cargs.extend([ 6096 "-rf-param-usexyz", 6097 self.rf_param_usexyz 6098 ]) 6099 return cargs
-rf-param-usexyz: Random Forest coordinate features
Syntax: -rf-param-usexyz
Use the coordinates of voxels as additional features. This allows some geometric relations between different labels to be learned. Equivalent to the corresponding ITK-SNAP option.
-rf-param-usexyz: Random Forest coordinate features
Syntax: -rf-param-usexyz
Use the coordinates of voxels as additional features. This allows some geometric relations between different labels to be learned. Equivalent to the corresponding ITK-SNAP option.
6082 def run( 6083 self, 6084 execution: Execution, 6085 ) -> list[str]: 6086 """ 6087 Build command line arguments. This method is called by the main command. 6088 6089 Args: 6090 execution: The execution object. 6091 Returns: 6092 Command line arguments 6093 """ 6094 cargs = [] 6095 cargs.extend([ 6096 "-rf-param-usexyz", 6097 self.rf_param_usexyz 6098 ]) 6099 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5898@dataclasses.dataclass 5899class C3dRfTrain: 5900 """ 5901 -rf-train: Train Random Forest classifier 5902 5903 Syntax: `-rf-train <classifier_file>` 5904 5905 This command trains a classifier using an implementation of the [Breyman et 5906 al. Random Forest Algorithm][Br2001], with modifications proposed by 5907 [Criminisi and Shotton][Cr2004]. The stack must contain one or more images 5908 of features (e.g., grayscale images), followed by a multi-label image. The 5909 latter must have at least two non-zero labels corresponding to different 5910 classes. The classifier is trained on a voxel by voxel basis. All voxels 5911 with label *L* are treated as the examples of class *L*. The classifier is 5912 output to a binary file that can later be used by the **-rf-apply** command. 5913 Multiple parameters can be specified with the **-rf-param-xxx** options 5914 before calling **-rf-train**. The stack is not modified by this command. 5915 5916 # Training with two MRI modalities as features and default parameters 5917 c3d t1_mri.nii t2_mri.nii segmentation.nii -rf-train myforest1.rf 5918 5919 # Training with patches as features (see docs for -rf-param-patch) 5920 c3d ultrasound.nii seg.nii -rf-param-patch 2x2x2 -rf-train myforest2.rf 5921 5922 # Applying the classifier 5923 c3d ultrasound.nii -rf-apply myforest2.rf -omc class_prob.nii.gz 5924 5925 The commands are meant to replicate the "classification" pre-segmentation 5926 mode in ITK-SNAP, i.e., extending a rough example segmentation to the entire 5927 image domain. It is possible to also use the commands to train classifiers 5928 jointly on data from multiple subjects, each with its own segmentation, as 5929 long as the images from the different subjects occupy the same image space 5930 and can be stacked into a 4-dimensional image. For example: 5931 5932 # Train using MRI and segmentations from N subjects 5933 c4d mri_subj*.nii -tile w -popas ALLMRI \ 5934 seg_subj*.nii -tile w -popas ALLSEG \ 5935 -rf-param-patch 2x2x2x0 \ 5936 -push ALLMRI -push ALLSEG -rf-train myforest.rf 5937 5938 # Apply using single MRI 5939 c4d mri_new.nii -rf-apply myforest.rf -omc classprob.nii 5940 5941 [Br2001] Breiman, L. (2001). Random forests. Machine learning, 45(1), 5-32. 5942 [Cr2004] Criminisi, A., & Shotton, J. (2013). Decision forests for computer 5943 vision and medical image analysis. Springer Science & Business Media. 5944 """ 5945 rf_train: str 5946 """-rf-train: Train Random Forest classifier 5947 5948 Syntax: `-rf-train <classifier_file>` 5949 5950 This command trains a classifier using an implementation of the [Breyman et 5951 al. Random Forest Algorithm][Br2001], with modifications proposed by 5952 [Criminisi and Shotton][Cr2004]. The stack must contain one or more images 5953 of features (e.g., grayscale images), followed by a multi-label image. The 5954 latter must have at least two non-zero labels corresponding to different 5955 classes. The classifier is trained on a voxel by voxel basis. All voxels 5956 with label *L* are treated as the examples of class *L*. The classifier is 5957 output to a binary file that can later be used by the **-rf-apply** command. 5958 Multiple parameters can be specified with the **-rf-param-xxx** options 5959 before calling **-rf-train**. The stack is not modified by this command. 5960 5961 # Training with two MRI modalities as features and default parameters 5962 c3d t1_mri.nii t2_mri.nii segmentation.nii -rf-train myforest1.rf 5963 5964 # Training with patches as features (see docs for -rf-param-patch) 5965 c3d ultrasound.nii seg.nii -rf-param-patch 2x2x2 -rf-train myforest2.rf 5966 5967 # Applying the classifier 5968 c3d ultrasound.nii -rf-apply myforest2.rf -omc class_prob.nii.gz 5969 5970 The commands are meant to replicate the "classification" pre-segmentation 5971 mode in ITK-SNAP, i.e., extending a rough example segmentation to the entire 5972 image domain. It is possible to also use the commands to train classifiers 5973 jointly on data from multiple subjects, each with its own segmentation, as 5974 long as the images from the different subjects occupy the same image space 5975 and can be stacked into a 4-dimensional image. For example: 5976 5977 # Train using MRI and segmentations from N subjects 5978 c4d mri_subj*.nii -tile w -popas ALLMRI \ 5979 seg_subj*.nii -tile w -popas ALLSEG \ 5980 -rf-param-patch 2x2x2x0 \ 5981 -push ALLMRI -push ALLSEG -rf-train myforest.rf 5982 5983 # Apply using single MRI 5984 c4d mri_new.nii -rf-apply myforest.rf -omc classprob.nii 5985 5986 [Br2001] Breiman, L. (2001). Random forests. Machine learning, 45(1), 5-32. 5987 [Cr2004] Criminisi, A., & Shotton, J. (2013). Decision forests for computer 5988 vision and medical image analysis. Springer Science & Business Media""" 5989 5990 def run( 5991 self, 5992 execution: Execution, 5993 ) -> list[str]: 5994 """ 5995 Build command line arguments. This method is called by the main command. 5996 5997 Args: 5998 execution: The execution object. 5999 Returns: 6000 Command line arguments 6001 """ 6002 cargs = [] 6003 cargs.extend([ 6004 "-rf-train", 6005 self.rf_train 6006 ]) 6007 return cargs
-rf-train: Train Random Forest classifier
Syntax: -rf-train <classifier_file>
This command trains a classifier using an implementation of the [Breyman et al. Random Forest Algorithm][Br2001], with modifications proposed by [Criminisi and Shotton][Cr2004]. The stack must contain one or more images of features (e.g., grayscale images), followed by a multi-label image. The latter must have at least two non-zero labels corresponding to different classes. The classifier is trained on a voxel by voxel basis. All voxels with label L are treated as the examples of class L. The classifier is output to a binary file that can later be used by the -rf-apply command. Multiple parameters can be specified with the -rf-param-xxx options before calling -rf-train. The stack is not modified by this command.
Training with two MRI modalities as features and default parameters
c3d t1_mri.nii t2_mri.nii segmentation.nii -rf-train myforest1.rf
Training with patches as features (see docs for -rf-param-patch)
c3d ultrasound.nii seg.nii -rf-param-patch 2x2x2 -rf-train myforest2.rf
Applying the classifier
c3d ultrasound.nii -rf-apply myforest2.rf -omc class_prob.nii.gz
The commands are meant to replicate the "classification" pre-segmentation mode in ITK-SNAP, i.e., extending a rough example segmentation to the entire image domain. It is possible to also use the commands to train classifiers jointly on data from multiple subjects, each with its own segmentation, as long as the images from the different subjects occupy the same image space and can be stacked into a 4-dimensional image. For example:
Train using MRI and segmentations from N subjects
c4d mri_subj*.nii -tile w -popas ALLMRI seg_subj*.nii -tile w -popas ALLSEG -rf-param-patch 2x2x2x0 -push ALLMRI -push ALLSEG -rf-train myforest.rf
Apply using single MRI
c4d mri_new.nii -rf-apply myforest.rf -omc classprob.nii
[Br2001] Breiman, L. (2001). Random forests. Machine learning, 45(1), 5-32. [Cr2004] Criminisi, A., & Shotton, J. (2013). Decision forests for computer vision and medical image analysis. Springer Science & Business Media.
-rf-train: Train Random Forest classifier
Syntax: -rf-train <classifier_file>
This command trains a classifier using an implementation of the [Breyman et al. Random Forest Algorithm][Br2001], with modifications proposed by [Criminisi and Shotton][Cr2004]. The stack must contain one or more images of features (e.g., grayscale images), followed by a multi-label image. The latter must have at least two non-zero labels corresponding to different classes. The classifier is trained on a voxel by voxel basis. All voxels with label L are treated as the examples of class L. The classifier is output to a binary file that can later be used by the -rf-apply command. Multiple parameters can be specified with the -rf-param-xxx options before calling -rf-train. The stack is not modified by this command.
Training with two MRI modalities as features and default parameters
c3d t1_mri.nii t2_mri.nii segmentation.nii -rf-train myforest1.rf
Training with patches as features (see docs for -rf-param-patch)
c3d ultrasound.nii seg.nii -rf-param-patch 2x2x2 -rf-train myforest2.rf
Applying the classifier
c3d ultrasound.nii -rf-apply myforest2.rf -omc class_prob.nii.gz
The commands are meant to replicate the "classification" pre-segmentation mode in ITK-SNAP, i.e., extending a rough example segmentation to the entire image domain. It is possible to also use the commands to train classifiers jointly on data from multiple subjects, each with its own segmentation, as long as the images from the different subjects occupy the same image space and can be stacked into a 4-dimensional image. For example:
Train using MRI and segmentations from N subjects
c4d mri_subj*.nii -tile w -popas ALLMRI seg_subj*.nii -tile w -popas ALLSEG -rf-param-patch 2x2x2x0 -push ALLMRI -push ALLSEG -rf-train myforest.rf
Apply using single MRI
c4d mri_new.nii -rf-apply myforest.rf -omc classprob.nii
[Br2001] Breiman, L. (2001). Random forests. Machine learning, 45(1), 5-32. [Cr2004] Criminisi, A., & Shotton, J. (2013). Decision forests for computer vision and medical image analysis. Springer Science & Business Media
5990 def run( 5991 self, 5992 execution: Execution, 5993 ) -> list[str]: 5994 """ 5995 Build command line arguments. This method is called by the main command. 5996 5997 Args: 5998 execution: The execution object. 5999 Returns: 6000 Command line arguments 6001 """ 6002 cargs = [] 6003 cargs.extend([ 6004 "-rf-train", 6005 self.rf_train 6006 ]) 6007 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6550@dataclasses.dataclass 6551class C3dRgb2hsv: 6552 """ 6553 -rgb2hsv: Convert RGB image to HSV image 6554 6555 Syntax `-rgb2hsv` 6556 6557 Takes the last three images on the stack and treats them as red, green, and 6558 blue channels. Outputs three images corresponding to hue, saturation, value. 6559 To read color images you need the ***-msc*** command. 6560 6561 c3d -mcs color.png -rgb2hsv -omc hsv.png. 6562 """ 6563 rgb2hsv: str 6564 """-rgb2hsv: Convert RGB image to HSV image 6565 6566 Syntax `-rgb2hsv` 6567 6568 Takes the last three images on the stack and treats them as red, green, and 6569 blue channels. Outputs three images corresponding to hue, saturation, value. 6570 To read color images you need the ***-msc*** command. 6571 6572 c3d -mcs color.png -rgb2hsv -omc hsv.png""" 6573 6574 def run( 6575 self, 6576 execution: Execution, 6577 ) -> list[str]: 6578 """ 6579 Build command line arguments. This method is called by the main command. 6580 6581 Args: 6582 execution: The execution object. 6583 Returns: 6584 Command line arguments 6585 """ 6586 cargs = [] 6587 cargs.extend([ 6588 "-rgb2hsv", 6589 self.rgb2hsv 6590 ]) 6591 return cargs
-rgb2hsv: Convert RGB image to HSV image
Syntax -rgb2hsv
Takes the last three images on the stack and treats them as red, green, and blue channels. Outputs three images corresponding to hue, saturation, value. To read color images you need the -msc command.
c3d -mcs color.png -rgb2hsv -omc hsv.png.
-rgb2hsv: Convert RGB image to HSV image
Syntax -rgb2hsv
Takes the last three images on the stack and treats them as red, green, and blue channels. Outputs three images corresponding to hue, saturation, value. To read color images you need the -msc command.
c3d -mcs color.png -rgb2hsv -omc hsv.png
6574 def run( 6575 self, 6576 execution: Execution, 6577 ) -> list[str]: 6578 """ 6579 Build command line arguments. This method is called by the main command. 6580 6581 Args: 6582 execution: The execution object. 6583 Returns: 6584 Command line arguments 6585 """ 6586 cargs = [] 6587 cargs.extend([ 6588 "-rgb2hsv", 6589 self.rgb2hsv 6590 ]) 6591 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6594@dataclasses.dataclass 6595class C3dRms: 6596 """ 6597 -rms: Voxelwise vector norm 6598 6599 Syntax: `-rms` 6600 6601 Computes RMS (root mean square) of all images on the stack. The command 6602 takes the square of each image on the stack, adds all the squared images and 6603 takes the square root of the result. This is very useful for statistical 6604 operations. Images must have the same size. 6605 6606 c3d img1.img img2.img img3.img img4.img -rms -o rms.img 6607 6608 The equivalent of this command is 6609 6610 c3d img1.img img2.img img3.img img4.img -foreach -dup -times -endfor \ 6611 -accum -add -endaccum -sqrt -o rms.img. 6612 """ 6613 rms: str 6614 """-rms: Voxelwise vector norm 6615 6616 Syntax: `-rms` 6617 6618 Computes RMS (root mean square) of all images on the stack. The command 6619 takes the square of each image on the stack, adds all the squared images and 6620 takes the square root of the result. This is very useful for statistical 6621 operations. Images must have the same size. 6622 6623 c3d img1.img img2.img img3.img img4.img -rms -o rms.img 6624 6625 The equivalent of this command is 6626 6627 c3d img1.img img2.img img3.img img4.img -foreach -dup -times -endfor \ 6628 -accum -add -endaccum -sqrt -o rms.img""" 6629 6630 def run( 6631 self, 6632 execution: Execution, 6633 ) -> list[str]: 6634 """ 6635 Build command line arguments. This method is called by the main command. 6636 6637 Args: 6638 execution: The execution object. 6639 Returns: 6640 Command line arguments 6641 """ 6642 cargs = [] 6643 cargs.extend([ 6644 "-rms", 6645 self.rms 6646 ]) 6647 return cargs
-rms: Voxelwise vector norm
Syntax: -rms
Computes RMS (root mean square) of all images on the stack. The command takes the square of each image on the stack, adds all the squared images and takes the square root of the result. This is very useful for statistical operations. Images must have the same size.
c3d img1.img img2.img img3.img img4.img -rms -o rms.img
The equivalent of this command is
c3d img1.img img2.img img3.img img4.img -foreach -dup -times -endfor -accum -add -endaccum -sqrt -o rms.img.
-rms: Voxelwise vector norm
Syntax: -rms
Computes RMS (root mean square) of all images on the stack. The command takes the square of each image on the stack, adds all the squared images and takes the square root of the result. This is very useful for statistical operations. Images must have the same size.
c3d img1.img img2.img img3.img img4.img -rms -o rms.img
The equivalent of this command is
c3d img1.img img2.img img3.img img4.img -foreach -dup -times -endfor -accum -add -endaccum -sqrt -o rms.img
6630 def run( 6631 self, 6632 execution: Execution, 6633 ) -> list[str]: 6634 """ 6635 Build command line arguments. This method is called by the main command. 6636 6637 Args: 6638 execution: The execution object. 6639 Returns: 6640 Command line arguments 6641 """ 6642 cargs = [] 6643 cargs.extend([ 6644 "-rms", 6645 self.rms 6646 ]) 6647 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6650@dataclasses.dataclass 6651class C3dRound: 6652 """ 6653 -noround, -round: Floating point rounding behavior 6654 6655 Syntax: `-noround` or `-round ` 6656 6657 By default, **convert3d** will round floating point values when converting 6658 to an integer, short or byte image. This command specifies that rounding 6659 should not be used. Rounding is used to avoid numerical errors stemming from 6660 the internal floating point representation. 6661 6662 c3d image1.img -type short -noround image2.img. 6663 """ 6664 round_: str 6665 """-noround, -round: Floating point rounding behavior 6666 6667 Syntax: `-noround` or `-round ` 6668 6669 By default, **convert3d** will round floating point values when converting 6670 to an integer, short or byte image. This command specifies that rounding 6671 should not be used. Rounding is used to avoid numerical errors stemming from 6672 the internal floating point representation. 6673 6674 c3d image1.img -type short -noround image2.img""" 6675 6676 def run( 6677 self, 6678 execution: Execution, 6679 ) -> list[str]: 6680 """ 6681 Build command line arguments. This method is called by the main command. 6682 6683 Args: 6684 execution: The execution object. 6685 Returns: 6686 Command line arguments 6687 """ 6688 cargs = [] 6689 cargs.extend([ 6690 "-round", 6691 self.round_ 6692 ]) 6693 return cargs
-noround, -round: Floating point rounding behavior
Syntax: -noround or -round
By default, convert3d will round floating point values when converting to an integer, short or byte image. This command specifies that rounding should not be used. Rounding is used to avoid numerical errors stemming from the internal floating point representation.
c3d image1.img -type short -noround image2.img.
-noround, -round: Floating point rounding behavior
Syntax: -noround or -round
By default, convert3d will round floating point values when converting to an integer, short or byte image. This command specifies that rounding should not be used. Rounding is used to avoid numerical errors stemming from the internal floating point representation.
c3d image1.img -type short -noround image2.img
6676 def run( 6677 self, 6678 execution: Execution, 6679 ) -> list[str]: 6680 """ 6681 Build command line arguments. This method is called by the main command. 6682 6683 Args: 6684 execution: The execution object. 6685 Returns: 6686 Command line arguments 6687 """ 6688 cargs = [] 6689 cargs.extend([ 6690 "-round", 6691 self.round_ 6692 ]) 6693 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6696@dataclasses.dataclass 6697class C3dScale: 6698 """ 6699 -scale: Scale intensity by constant factor 6700 6701 Syntax: `-scale <factor>` 6702 6703 Multiplies the intensity of each voxel in the last image on the stack by the 6704 given factor. 6705 6706 c3d img1.img -scale 0.5 -o img2.img. 6707 """ 6708 scale: str 6709 """-scale: Scale intensity by constant factor 6710 6711 Syntax: `-scale <factor>` 6712 6713 Multiplies the intensity of each voxel in the last image on the stack by the 6714 given factor. 6715 6716 c3d img1.img -scale 0.5 -o img2.img""" 6717 6718 def run( 6719 self, 6720 execution: Execution, 6721 ) -> list[str]: 6722 """ 6723 Build command line arguments. This method is called by the main command. 6724 6725 Args: 6726 execution: The execution object. 6727 Returns: 6728 Command line arguments 6729 """ 6730 cargs = [] 6731 cargs.extend([ 6732 "-scale", 6733 self.scale 6734 ]) 6735 return cargs
-scale: Scale intensity by constant factor
Syntax: -scale <factor>
Multiplies the intensity of each voxel in the last image on the stack by the given factor.
c3d img1.img -scale 0.5 -o img2.img.
-scale: Scale intensity by constant factor
Syntax: -scale <factor>
Multiplies the intensity of each voxel in the last image on the stack by the given factor.
c3d img1.img -scale 0.5 -o img2.img
6718 def run( 6719 self, 6720 execution: Execution, 6721 ) -> list[str]: 6722 """ 6723 Build command line arguments. This method is called by the main command. 6724 6725 Args: 6726 execution: The execution object. 6727 Returns: 6728 Command line arguments 6729 """ 6730 cargs = [] 6731 cargs.extend([ 6732 "-scale", 6733 self.scale 6734 ]) 6735 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
304@dataclasses.dataclass 305class C3dSet: 306 """ 307 -as: Assign image at the end of the stack to a variable 308 309 Syntax: `-as var` 310 311 Associates the image currently at the end of the stack with variable name 312 'var'. This allows you to retrieve the image later on the command line using 313 the **-push** command. The **-as** and **-push** commands are useful when 314 you need to use a certain image more than once during a convert3d operation. 315 For example, if you want to compute the distance transform of a binary image 316 and mask it so that the values outside of the binary image region have value 317 0, you would use the following command: 318 319 c3d binary.img -as A -sdt -push A -times -o masked_distance.img. 320 """ 321 set_: str 322 """-as: Assign image at the end of the stack to a variable 323 324 Syntax: `-as var` 325 326 Associates the image currently at the end of the stack with variable name 327 'var'. This allows you to retrieve the image later on the command line using 328 the **-push** command. The **-as** and **-push** commands are useful when 329 you need to use a certain image more than once during a convert3d operation. 330 For example, if you want to compute the distance transform of a binary image 331 and mask it so that the values outside of the binary image region have value 332 0, you would use the following command: 333 334 c3d binary.img -as A -sdt -push A -times -o masked_distance.img""" 335 336 def run( 337 self, 338 execution: Execution, 339 ) -> list[str]: 340 """ 341 Build command line arguments. This method is called by the main command. 342 343 Args: 344 execution: The execution object. 345 Returns: 346 Command line arguments 347 """ 348 cargs = [] 349 cargs.extend([ 350 "-as", 351 self.set_ 352 ]) 353 return cargs
-as: Assign image at the end of the stack to a variable
Syntax: -as var
Associates the image currently at the end of the stack with variable name 'var'. This allows you to retrieve the image later on the command line using the -push command. The -as and -push commands are useful when you need to use a certain image more than once during a convert3d operation. For example, if you want to compute the distance transform of a binary image and mask it so that the values outside of the binary image region have value 0, you would use the following command:
c3d binary.img -as A -sdt -push A -times -o masked_distance.img.
-as: Assign image at the end of the stack to a variable
Syntax: -as var
Associates the image currently at the end of the stack with variable name 'var'. This allows you to retrieve the image later on the command line using the -push command. The -as and -push commands are useful when you need to use a certain image more than once during a convert3d operation. For example, if you want to compute the distance transform of a binary image and mask it so that the values outside of the binary image region have value 0, you would use the following command:
c3d binary.img -as A -sdt -push A -times -o masked_distance.img
336 def run( 337 self, 338 execution: Execution, 339 ) -> list[str]: 340 """ 341 Build command line arguments. This method is called by the main command. 342 343 Args: 344 execution: The execution object. 345 Returns: 346 Command line arguments 347 """ 348 cargs = [] 349 cargs.extend([ 350 "-as", 351 self.set_ 352 ]) 353 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6206@dataclasses.dataclass 6207class C3dSetSform: 6208 """ 6209 -set-sform: Set the transform to physical space 6210 6211 Syntax: `-set-sform <sform.mat> ` 6212 6213 Sets the Nifti sform of the last image on the stack to the 4x4 matrix 6214 provided. 6215 """ 6216 set_sform: str 6217 """-set-sform: Set the transform to physical space 6218 6219 Syntax: `-set-sform <sform.mat> ` 6220 6221 Sets the Nifti sform of the last image on the stack to the 4x4 matrix 6222 provided.""" 6223 6224 def run( 6225 self, 6226 execution: Execution, 6227 ) -> list[str]: 6228 """ 6229 Build command line arguments. This method is called by the main command. 6230 6231 Args: 6232 execution: The execution object. 6233 Returns: 6234 Command line arguments 6235 """ 6236 cargs = [] 6237 cargs.extend([ 6238 "-set-sform", 6239 self.set_sform 6240 ]) 6241 return cargs
-set-sform: Set the transform to physical space
Syntax: -set-sform <sform.mat>
Sets the Nifti sform of the last image on the stack to the 4x4 matrix provided.
-set-sform: Set the transform to physical space
Syntax: -set-sform <sform.mat>
Sets the Nifti sform of the last image on the stack to the 4x4 matrix provided.
6224 def run( 6225 self, 6226 execution: Execution, 6227 ) -> list[str]: 6228 """ 6229 Build command line arguments. This method is called by the main command. 6230 6231 Args: 6232 execution: The execution object. 6233 Returns: 6234 Command line arguments 6235 """ 6236 cargs = [] 6237 cargs.extend([ 6238 "-set-sform", 6239 self.set_sform 6240 ]) 6241 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6738@dataclasses.dataclass 6739class C3dSetSform_: 6740 """ 6741 -set-sform: Set the transform to physical space 6742 6743 Syntax: `-set-sform <sform.mat> ` 6744 6745 Sets the Nifti sform of the last image on the stack to the 4x4 matrix 6746 provided. 6747 """ 6748 set_sform: str 6749 """-set-sform: Set the transform to physical space 6750 6751 Syntax: `-set-sform <sform.mat> ` 6752 6753 Sets the Nifti sform of the last image on the stack to the 4x4 matrix 6754 provided.""" 6755 6756 def run( 6757 self, 6758 execution: Execution, 6759 ) -> list[str]: 6760 """ 6761 Build command line arguments. This method is called by the main command. 6762 6763 Args: 6764 execution: The execution object. 6765 Returns: 6766 Command line arguments 6767 """ 6768 cargs = [] 6769 cargs.extend([ 6770 "-set-sform", 6771 self.set_sform 6772 ]) 6773 return cargs
-set-sform: Set the transform to physical space
Syntax: -set-sform <sform.mat>
Sets the Nifti sform of the last image on the stack to the 4x4 matrix provided.
-set-sform: Set the transform to physical space
Syntax: -set-sform <sform.mat>
Sets the Nifti sform of the last image on the stack to the 4x4 matrix provided.
6756 def run( 6757 self, 6758 execution: Execution, 6759 ) -> list[str]: 6760 """ 6761 Build command line arguments. This method is called by the main command. 6762 6763 Args: 6764 execution: The execution object. 6765 Returns: 6766 Command line arguments 6767 """ 6768 cargs = [] 6769 cargs.extend([ 6770 "-set-sform", 6771 self.set_sform 6772 ]) 6773 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6932@dataclasses.dataclass 6933class C3dSharpen: 6934 """ 6935 -sharpen: Sharpen edges in the image 6936 6937 Syntax: `-sharpen` 6938 6939 Applies the Laplacian sharpening filter from ITK, which accentuates the 6940 edges in the image. 6941 6942 c3d input.nii.gz -sharpen -o output.nii.gz. 6943 """ 6944 sharpen: str 6945 """-sharpen: Sharpen edges in the image 6946 6947 Syntax: `-sharpen` 6948 6949 Applies the Laplacian sharpening filter from ITK, which accentuates the 6950 edges in the image. 6951 6952 c3d input.nii.gz -sharpen -o output.nii.gz""" 6953 6954 def run( 6955 self, 6956 execution: Execution, 6957 ) -> list[str]: 6958 """ 6959 Build command line arguments. This method is called by the main command. 6960 6961 Args: 6962 execution: The execution object. 6963 Returns: 6964 Command line arguments 6965 """ 6966 cargs = [] 6967 cargs.extend([ 6968 "-sharpen", 6969 self.sharpen 6970 ]) 6971 return cargs
-sharpen: Sharpen edges in the image
Syntax: -sharpen
Applies the Laplacian sharpening filter from ITK, which accentuates the edges in the image.
c3d input.nii.gz -sharpen -o output.nii.gz.
-sharpen: Sharpen edges in the image
Syntax: -sharpen
Applies the Laplacian sharpening filter from ITK, which accentuates the edges in the image.
c3d input.nii.gz -sharpen -o output.nii.gz
6954 def run( 6955 self, 6956 execution: Execution, 6957 ) -> list[str]: 6958 """ 6959 Build command line arguments. This method is called by the main command. 6960 6961 Args: 6962 execution: The execution object. 6963 Returns: 6964 Command line arguments 6965 """ 6966 cargs = [] 6967 cargs.extend([ 6968 "-sharpen", 6969 self.sharpen 6970 ]) 6971 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6974@dataclasses.dataclass 6975class C3dShift: 6976 """ 6977 -shift: Shift image intensity by constant 6978 6979 Syntax: `-shift <constant>` 6980 6981 Adds the given constant to every voxel. 6982 6983 c3d img1.img -shift 100 -o img2.img. 6984 """ 6985 shift: str 6986 """-shift: Shift image intensity by constant 6987 6988 Syntax: `-shift <constant>` 6989 6990 Adds the given constant to every voxel. 6991 6992 c3d img1.img -shift 100 -o img2.img""" 6993 6994 def run( 6995 self, 6996 execution: Execution, 6997 ) -> list[str]: 6998 """ 6999 Build command line arguments. This method is called by the main command. 7000 7001 Args: 7002 execution: The execution object. 7003 Returns: 7004 Command line arguments 7005 """ 7006 cargs = [] 7007 cargs.extend([ 7008 "-shift", 7009 self.shift 7010 ]) 7011 return cargs
-shift: Shift image intensity by constant
Syntax: -shift <constant>
Adds the given constant to every voxel.
c3d img1.img -shift 100 -o img2.img.
-shift: Shift image intensity by constant
Syntax: -shift <constant>
Adds the given constant to every voxel.
c3d img1.img -shift 100 -o img2.img
6994 def run( 6995 self, 6996 execution: Execution, 6997 ) -> list[str]: 6998 """ 6999 Build command line arguments. This method is called by the main command. 7000 7001 Args: 7002 execution: The execution object. 7003 Returns: 7004 Command line arguments 7005 """ 7006 cargs = [] 7007 cargs.extend([ 7008 "-shift", 7009 self.shift 7010 ]) 7011 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7014@dataclasses.dataclass 7015class C3dSignedDistanceTransform: 7016 """ 7017 -sdt, -signed-distance-transform: Signed distance transform of a binary 7018 image 7019 7020 Syntax: `-sdt` 7021 7022 Computes the signed distance transform of a binary image. Voxels where the 7023 binary image is non-zero will have negative values and voxels where the 7024 binary image is zero will have negative values. The magnitude of the value 7025 will be the approximate Euclidean distance to the boundary of the object 7026 represented by the binary image. 7027 7028 c3d binary.img -sdt -o dist.img. 7029 """ 7030 signed_distance_transform: str 7031 """-sdt, -signed-distance-transform: Signed distance transform of a binary 7032 image 7033 7034 Syntax: `-sdt` 7035 7036 Computes the signed distance transform of a binary image. Voxels where the 7037 binary image is non-zero will have negative values and voxels where the 7038 binary image is zero will have negative values. The magnitude of the value 7039 will be the approximate Euclidean distance to the boundary of the object 7040 represented by the binary image. 7041 7042 c3d binary.img -sdt -o dist.img""" 7043 7044 def run( 7045 self, 7046 execution: Execution, 7047 ) -> list[str]: 7048 """ 7049 Build command line arguments. This method is called by the main command. 7050 7051 Args: 7052 execution: The execution object. 7053 Returns: 7054 Command line arguments 7055 """ 7056 cargs = [] 7057 cargs.extend([ 7058 "-signed-distance-transform", 7059 self.signed_distance_transform 7060 ]) 7061 return cargs
-sdt, -signed-distance-transform: Signed distance transform of a binary image
Syntax: -sdt
Computes the signed distance transform of a binary image. Voxels where the binary image is non-zero will have negative values and voxels where the binary image is zero will have negative values. The magnitude of the value will be the approximate Euclidean distance to the boundary of the object represented by the binary image.
c3d binary.img -sdt -o dist.img.
-sdt, -signed-distance-transform: Signed distance transform of a binary image
Syntax: -sdt
Computes the signed distance transform of a binary image. Voxels where the binary image is non-zero will have negative values and voxels where the binary image is zero will have negative values. The magnitude of the value will be the approximate Euclidean distance to the boundary of the object represented by the binary image.
c3d binary.img -sdt -o dist.img
7044 def run( 7045 self, 7046 execution: Execution, 7047 ) -> list[str]: 7048 """ 7049 Build command line arguments. This method is called by the main command. 7050 7051 Args: 7052 execution: The execution object. 7053 Returns: 7054 Command line arguments 7055 """ 7056 cargs = [] 7057 cargs.extend([ 7058 "-signed-distance-transform", 7059 self.signed_distance_transform 7060 ]) 7061 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6776@dataclasses.dataclass 6777class C3dSin: 6778 """ 6779 -cos: Voxelwise cosine 6780 6781 Syntax: `-sin` 6782 6783 Replaces the last image on the stack with the cosine trigonometric operation 6784 applied to all voxels. Input must be in radians. 6785 """ 6786 sin: str 6787 """-cos: Voxelwise cosine 6788 6789 Syntax: `-sin` 6790 6791 Replaces the last image on the stack with the cosine trigonometric operation 6792 applied to all voxels. Input must be in radians.""" 6793 6794 def run( 6795 self, 6796 execution: Execution, 6797 ) -> list[str]: 6798 """ 6799 Build command line arguments. This method is called by the main command. 6800 6801 Args: 6802 execution: The execution object. 6803 Returns: 6804 Command line arguments 6805 """ 6806 cargs = [] 6807 cargs.extend([ 6808 "-sin", 6809 self.sin 6810 ]) 6811 return cargs
-cos: Voxelwise cosine
Syntax: -sin
Replaces the last image on the stack with the cosine trigonometric operation applied to all voxels. Input must be in radians.
-cos: Voxelwise cosine
Syntax: -sin
Replaces the last image on the stack with the cosine trigonometric operation applied to all voxels. Input must be in radians.
6794 def run( 6795 self, 6796 execution: Execution, 6797 ) -> list[str]: 6798 """ 6799 Build command line arguments. This method is called by the main command. 6800 6801 Args: 6802 execution: The execution object. 6803 Returns: 6804 Command line arguments 6805 """ 6806 cargs = [] 6807 cargs.extend([ 6808 "-sin", 6809 self.sin 6810 ]) 6811 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6814@dataclasses.dataclass 6815class C3dSlice: 6816 """ 6817 -slice: Extract slices from an image 6818 6819 Syntax: `-slice axis position_spec` 6820 6821 Extracts a slice along the specified axis (x,y or z). The position specifier 6822 **position_spec** can be a single slice or a range of slices. For a single 6823 slice, it can be specified as a number or a percentage. Numbering is 6824 zero-based, i.e, the first slice is slice 0, the last slice is N-1, where N 6825 is the number of slices. For a range, use MATLAB notation first:step:last. 6826 The slice is placed on the stack as an image with size 1 in the last 6827 dimension. You can save the slice as a 2D PNG image. 6828 6829 c3d input.img -slice x 128 -o myslice.nii.gz 6830 c3d input.img -slice y 50% myslice.nii.gz 6831 c3d input.img -slice z 25% -type uchar -stretch 0 2000 0 255 -o myslice.png 6832 c3d input.img -slice z 0:-1 -oo slice%0d.nii.gz 6833 c3d input.img -slice z 20%:10%:80% -oo slice%0d.nii.gz 6834 6835 With the new command **c4d**, the **-slice** command can be used to extract 6836 volumes from a 4D image. This can be useful to reformat a 4D NIFTI image as 6837 a 3D multi-component NIFTI image, using the command 6838 6839 c4d input4d.nii.gz -slice w 0:-1 -omc output3d_multicomp.nii.gz. 6840 """ 6841 slice_: str 6842 """-slice: Extract slices from an image 6843 6844 Syntax: `-slice axis position_spec` 6845 6846 Extracts a slice along the specified axis (x,y or z). The position specifier 6847 **position_spec** can be a single slice or a range of slices. For a single 6848 slice, it can be specified as a number or a percentage. Numbering is 6849 zero-based, i.e, the first slice is slice 0, the last slice is N-1, where N 6850 is the number of slices. For a range, use MATLAB notation first:step:last. 6851 The slice is placed on the stack as an image with size 1 in the last 6852 dimension. You can save the slice as a 2D PNG image. 6853 6854 c3d input.img -slice x 128 -o myslice.nii.gz 6855 c3d input.img -slice y 50% myslice.nii.gz 6856 c3d input.img -slice z 25% -type uchar -stretch 0 2000 0 255 -o myslice.png 6857 c3d input.img -slice z 0:-1 -oo slice%0d.nii.gz 6858 c3d input.img -slice z 20%:10%:80% -oo slice%0d.nii.gz 6859 6860 With the new command **c4d**, the **-slice** command can be used to extract 6861 volumes from a 4D image. This can be useful to reformat a 4D NIFTI image as 6862 a 3D multi-component NIFTI image, using the command 6863 6864 c4d input4d.nii.gz -slice w 0:-1 -omc output3d_multicomp.nii.gz""" 6865 6866 def run( 6867 self, 6868 execution: Execution, 6869 ) -> list[str]: 6870 """ 6871 Build command line arguments. This method is called by the main command. 6872 6873 Args: 6874 execution: The execution object. 6875 Returns: 6876 Command line arguments 6877 """ 6878 cargs = [] 6879 cargs.extend([ 6880 "-slice", 6881 self.slice_ 6882 ]) 6883 return cargs
-slice: Extract slices from an image
Syntax: -slice axis position_spec
Extracts a slice along the specified axis (x,y or z). The position specifier position_spec can be a single slice or a range of slices. For a single slice, it can be specified as a number or a percentage. Numbering is zero-based, i.e, the first slice is slice 0, the last slice is N-1, where N is the number of slices. For a range, use MATLAB notation first:step:last. The slice is placed on the stack as an image with size 1 in the last dimension. You can save the slice as a 2D PNG image.
c3d input.img -slice x 128 -o myslice.nii.gz c3d input.img -slice y 50% myslice.nii.gz c3d input.img -slice z 25% -type uchar -stretch 0 2000 0 255 -o myslice.png c3d input.img -slice z 0:-1 -oo slice%0d.nii.gz c3d input.img -slice z 20%:10%:80% -oo slice%0d.nii.gz
With the new command c4d, the -slice command can be used to extract volumes from a 4D image. This can be useful to reformat a 4D NIFTI image as a 3D multi-component NIFTI image, using the command
c4d input4d.nii.gz -slice w 0:-1 -omc output3d_multicomp.nii.gz.
-slice: Extract slices from an image
Syntax: -slice axis position_spec
Extracts a slice along the specified axis (x,y or z). The position specifier position_spec can be a single slice or a range of slices. For a single slice, it can be specified as a number or a percentage. Numbering is zero-based, i.e, the first slice is slice 0, the last slice is N-1, where N is the number of slices. For a range, use MATLAB notation first:step:last. The slice is placed on the stack as an image with size 1 in the last dimension. You can save the slice as a 2D PNG image.
c3d input.img -slice x 128 -o myslice.nii.gz c3d input.img -slice y 50% myslice.nii.gz c3d input.img -slice z 25% -type uchar -stretch 0 2000 0 255 -o myslice.png c3d input.img -slice z 0:-1 -oo slice%0d.nii.gz c3d input.img -slice z 20%:10%:80% -oo slice%0d.nii.gz
With the new command c4d, the -slice command can be used to extract volumes from a 4D image. This can be useful to reformat a 4D NIFTI image as a 3D multi-component NIFTI image, using the command
c4d input4d.nii.gz -slice w 0:-1 -omc output3d_multicomp.nii.gz
6866 def run( 6867 self, 6868 execution: Execution, 6869 ) -> list[str]: 6870 """ 6871 Build command line arguments. This method is called by the main command. 6872 6873 Args: 6874 execution: The execution object. 6875 Returns: 6876 Command line arguments 6877 """ 6878 cargs = [] 6879 cargs.extend([ 6880 "-slice", 6881 self.slice_ 6882 ]) 6883 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6886@dataclasses.dataclass 6887class C3dSliceAll: 6888 """ 6889 -slice-all: Extract slices from all images on the stack 6890 6891 Syntax `-slice-all axis position_spec` 6892 6893 This command behaves identical to the **-slice** command, but all images on 6894 the stack are sliced, and the slices are interleaved. This is useful for 6895 slicing multi-component images. For example, if you read a four-component 6896 image 'test4.nii.gz', you can extract and save the slices as follows: 6897 6898 c3d test4.nii.gz -slice-all 20%:10%:80% -oomc 4 slice4_%03d.nii.gz. 6899 """ 6900 slice_all: str 6901 """-slice-all: Extract slices from all images on the stack 6902 6903 Syntax `-slice-all axis position_spec` 6904 6905 This command behaves identical to the **-slice** command, but all images on 6906 the stack are sliced, and the slices are interleaved. This is useful for 6907 slicing multi-component images. For example, if you read a four-component 6908 image 'test4.nii.gz', you can extract and save the slices as follows: 6909 6910 c3d test4.nii.gz -slice-all 20%:10%:80% -oomc 4 slice4_%03d.nii.gz""" 6911 6912 def run( 6913 self, 6914 execution: Execution, 6915 ) -> list[str]: 6916 """ 6917 Build command line arguments. This method is called by the main command. 6918 6919 Args: 6920 execution: The execution object. 6921 Returns: 6922 Command line arguments 6923 """ 6924 cargs = [] 6925 cargs.extend([ 6926 "-slice-all", 6927 self.slice_all 6928 ]) 6929 return cargs
-slice-all: Extract slices from all images on the stack
Syntax -slice-all axis position_spec
This command behaves identical to the -slice command, but all images on the stack are sliced, and the slices are interleaved. This is useful for slicing multi-component images. For example, if you read a four-component image 'test4.nii.gz', you can extract and save the slices as follows:
c3d test4.nii.gz -slice-all 20%:10%:80% -oomc 4 slice4_%03d.nii.gz.
-slice-all: Extract slices from all images on the stack
Syntax -slice-all axis position_spec
This command behaves identical to the -slice command, but all images on the stack are sliced, and the slices are interleaved. This is useful for slicing multi-component images. For example, if you read a four-component image 'test4.nii.gz', you can extract and save the slices as follows:
c3d test4.nii.gz -slice-all 20%:10%:80% -oomc 4 slice4_%03d.nii.gz
6912 def run( 6913 self, 6914 execution: Execution, 6915 ) -> list[str]: 6916 """ 6917 Build command line arguments. This method is called by the main command. 6918 6919 Args: 6920 execution: The execution object. 6921 Returns: 6922 Command line arguments 6923 """ 6924 cargs = [] 6925 cargs.extend([ 6926 "-slice-all", 6927 self.slice_all 6928 ]) 6929 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7064@dataclasses.dataclass 7065class C3dSmooth: 7066 """ 7067 -smooth: Gaussian smoothing 7068 7069 Syntax: `-smooth <sigma_vector> ` 7070 7071 Applies Gaussian smoothing to the image. The parameter vector specifies the 7072 standard deviation of the Gaussian kernel. Also see [Vector Format 7073 Specification][10] below. 7074 7075 c3d img1.img -smooth 2x1x1vox -o out.img. 7076 """ 7077 smooth: str 7078 """-smooth: Gaussian smoothing 7079 7080 Syntax: `-smooth <sigma_vector> ` 7081 7082 Applies Gaussian smoothing to the image. The parameter vector specifies the 7083 standard deviation of the Gaussian kernel. Also see [Vector Format 7084 Specification][10] below. 7085 7086 c3d img1.img -smooth 2x1x1vox -o out.img""" 7087 7088 def run( 7089 self, 7090 execution: Execution, 7091 ) -> list[str]: 7092 """ 7093 Build command line arguments. This method is called by the main command. 7094 7095 Args: 7096 execution: The execution object. 7097 Returns: 7098 Command line arguments 7099 """ 7100 cargs = [] 7101 cargs.extend([ 7102 "-smooth", 7103 self.smooth 7104 ]) 7105 return cargs
-smooth: Gaussian smoothing
Syntax: -smooth <sigma_vector>
Applies Gaussian smoothing to the image. The parameter vector specifies the standard deviation of the Gaussian kernel. Also see [Vector Format Specification][10] below.
c3d img1.img -smooth 2x1x1vox -o out.img.
-smooth: Gaussian smoothing
Syntax: -smooth <sigma_vector>
Applies Gaussian smoothing to the image. The parameter vector specifies the standard deviation of the Gaussian kernel. Also see [Vector Format Specification][10] below.
c3d img1.img -smooth 2x1x1vox -o out.img
7088 def run( 7089 self, 7090 execution: Execution, 7091 ) -> list[str]: 7092 """ 7093 Build command line arguments. This method is called by the main command. 7094 7095 Args: 7096 execution: The execution object. 7097 Returns: 7098 Command line arguments 7099 """ 7100 cargs = [] 7101 cargs.extend([ 7102 "-smooth", 7103 self.smooth 7104 ]) 7105 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7108@dataclasses.dataclass 7109class C3dSmoothFast: 7110 """ 7111 -smooth-fast: Fast approximate Gaussian smoothing 7112 7113 Syntax: `-smooth-fast <sigma_vector> ` 7114 7115 Applies Gaussian smoothing to the image using the fast [Deriche recursive 7116 smoothing algorithm][15]. The parameter vector specifies the standard 7117 deviation of the Gaussian kernel. Also see [Vector Format Specification][10] 7118 below. 7119 7120 c3d img1.img -smooth-fast 20x10x10vox -o out.img. 7121 """ 7122 smooth_fast: str 7123 """-smooth-fast: Fast approximate Gaussian smoothing 7124 7125 Syntax: `-smooth-fast <sigma_vector> ` 7126 7127 Applies Gaussian smoothing to the image using the fast [Deriche recursive 7128 smoothing algorithm][15]. The parameter vector specifies the standard 7129 deviation of the Gaussian kernel. Also see [Vector Format Specification][10] 7130 below. 7131 7132 c3d img1.img -smooth-fast 20x10x10vox -o out.img""" 7133 7134 def run( 7135 self, 7136 execution: Execution, 7137 ) -> list[str]: 7138 """ 7139 Build command line arguments. This method is called by the main command. 7140 7141 Args: 7142 execution: The execution object. 7143 Returns: 7144 Command line arguments 7145 """ 7146 cargs = [] 7147 cargs.extend([ 7148 "-smooth-fast", 7149 self.smooth_fast 7150 ]) 7151 return cargs
-smooth-fast: Fast approximate Gaussian smoothing
Syntax: -smooth-fast <sigma_vector>
Applies Gaussian smoothing to the image using the fast [Deriche recursive smoothing algorithm][15]. The parameter vector specifies the standard deviation of the Gaussian kernel. Also see [Vector Format Specification][10] below.
c3d img1.img -smooth-fast 20x10x10vox -o out.img.
-smooth-fast: Fast approximate Gaussian smoothing
Syntax: -smooth-fast <sigma_vector>
Applies Gaussian smoothing to the image using the fast [Deriche recursive smoothing algorithm][15]. The parameter vector specifies the standard deviation of the Gaussian kernel. Also see [Vector Format Specification][10] below.
c3d img1.img -smooth-fast 20x10x10vox -o out.img
7134 def run( 7135 self, 7136 execution: Execution, 7137 ) -> list[str]: 7138 """ 7139 Build command line arguments. This method is called by the main command. 7140 7141 Args: 7142 execution: The execution object. 7143 Returns: 7144 Command line arguments 7145 """ 7146 cargs = [] 7147 cargs.extend([ 7148 "-smooth-fast", 7149 self.smooth_fast 7150 ]) 7151 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7154@dataclasses.dataclass 7155class C3dSpacing: 7156 """ 7157 -spacing: Set voxel spacing 7158 7159 Syntax: `-spacing <vector> ` 7160 7161 Sets the voxel spacing of the image. This should always be a vector with 7162 positive components. For example, to set the spacing of the image to 1mm 7163 isotropic, use the command below. This command only changes the header of 7164 the image, not its contents. 7165 7166 c3d img.nii -spacing 1x1x1mm -o out.img. 7167 """ 7168 spacing: str 7169 """-spacing: Set voxel spacing 7170 7171 Syntax: `-spacing <vector> ` 7172 7173 Sets the voxel spacing of the image. This should always be a vector with 7174 positive components. For example, to set the spacing of the image to 1mm 7175 isotropic, use the command below. This command only changes the header of 7176 the image, not its contents. 7177 7178 c3d img.nii -spacing 1x1x1mm -o out.img""" 7179 7180 def run( 7181 self, 7182 execution: Execution, 7183 ) -> list[str]: 7184 """ 7185 Build command line arguments. This method is called by the main command. 7186 7187 Args: 7188 execution: The execution object. 7189 Returns: 7190 Command line arguments 7191 """ 7192 cargs = [] 7193 cargs.extend([ 7194 "-spacing", 7195 self.spacing 7196 ]) 7197 return cargs
-spacing: Set voxel spacing
Syntax: -spacing <vector>
Sets the voxel spacing of the image. This should always be a vector with positive components. For example, to set the spacing of the image to 1mm isotropic, use the command below. This command only changes the header of the image, not its contents.
c3d img.nii -spacing 1x1x1mm -o out.img.
-spacing: Set voxel spacing
Syntax: -spacing <vector>
Sets the voxel spacing of the image. This should always be a vector with positive components. For example, to set the spacing of the image to 1mm isotropic, use the command below. This command only changes the header of the image, not its contents.
c3d img.nii -spacing 1x1x1mm -o out.img
7180 def run( 7181 self, 7182 execution: Execution, 7183 ) -> list[str]: 7184 """ 7185 Build command line arguments. This method is called by the main command. 7186 7187 Args: 7188 execution: The execution object. 7189 Returns: 7190 Command line arguments 7191 """ 7192 cargs = [] 7193 cargs.extend([ 7194 "-spacing", 7195 self.spacing 7196 ]) 7197 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7200@dataclasses.dataclass 7201class C3dSplit: 7202 """ 7203 -split: Split multi-label image into binary images 7204 7205 Syntax: `-split` 7206 7207 This command takes a multilabel image (one with a small number of discrete 7208 intensity levels), and replaces it with a set of binary images, one for each 7209 of the levels. The images can later be recombined using the **-merge** 7210 command. The labels corresponding to each binary image are remembered by 7211 **convert3d** so that when **-merge** is called, the labels are faithfully 7212 reassigned. The **-merge** command treats each input as a probability image, 7213 and selects at each voxel the label that has highest probability. The 7214 example below smooths each label independently, then recombines using 7215 **-merge** 7216 7217 c3d multilabel.nii -split -foreach -smooth 3mm -endfor -merge -o 7218 ml_smooth.nii 7219 7220 Also of note is that the **-split** command will disregard infinite 7221 intensity values. So if you want to apply voting to a subset of the labels, 7222 you can replace labels you do not care about with *inf*, for example, using 7223 the **-thresh** command. 7224 """ 7225 split: str 7226 """-split: Split multi-label image into binary images 7227 7228 Syntax: `-split` 7229 7230 This command takes a multilabel image (one with a small number of discrete 7231 intensity levels), and replaces it with a set of binary images, one for each 7232 of the levels. The images can later be recombined using the **-merge** 7233 command. The labels corresponding to each binary image are remembered by 7234 **convert3d** so that when **-merge** is called, the labels are faithfully 7235 reassigned. The **-merge** command treats each input as a probability image, 7236 and selects at each voxel the label that has highest probability. The 7237 example below smooths each label independently, then recombines using 7238 **-merge** 7239 7240 c3d multilabel.nii -split -foreach -smooth 3mm -endfor -merge -o 7241 ml_smooth.nii 7242 7243 Also of note is that the **-split** command will disregard infinite 7244 intensity values. So if you want to apply voting to a subset of the labels, 7245 you can replace labels you do not care about with *inf*, for example, using 7246 the **-thresh** command.""" 7247 7248 def run( 7249 self, 7250 execution: Execution, 7251 ) -> list[str]: 7252 """ 7253 Build command line arguments. This method is called by the main command. 7254 7255 Args: 7256 execution: The execution object. 7257 Returns: 7258 Command line arguments 7259 """ 7260 cargs = [] 7261 cargs.extend([ 7262 "-split", 7263 self.split 7264 ]) 7265 return cargs
-split: Split multi-label image into binary images
Syntax: -split
This command takes a multilabel image (one with a small number of discrete intensity levels), and replaces it with a set of binary images, one for each of the levels. The images can later be recombined using the -merge command. The labels corresponding to each binary image are remembered by convert3d so that when -merge is called, the labels are faithfully reassigned. The -merge command treats each input as a probability image, and selects at each voxel the label that has highest probability. The example below smooths each label independently, then recombines using -merge
c3d multilabel.nii -split -foreach -smooth 3mm -endfor -merge -o ml_smooth.nii
Also of note is that the -split command will disregard infinite intensity values. So if you want to apply voting to a subset of the labels, you can replace labels you do not care about with inf, for example, using the -thresh command.
-split: Split multi-label image into binary images
Syntax: -split
This command takes a multilabel image (one with a small number of discrete intensity levels), and replaces it with a set of binary images, one for each of the levels. The images can later be recombined using the -merge command. The labels corresponding to each binary image are remembered by convert3d so that when -merge is called, the labels are faithfully reassigned. The -merge command treats each input as a probability image, and selects at each voxel the label that has highest probability. The example below smooths each label independently, then recombines using -merge
c3d multilabel.nii -split -foreach -smooth 3mm -endfor -merge -o ml_smooth.nii
Also of note is that the -split command will disregard infinite intensity values. So if you want to apply voting to a subset of the labels, you can replace labels you do not care about with inf, for example, using the -thresh command.
7248 def run( 7249 self, 7250 execution: Execution, 7251 ) -> list[str]: 7252 """ 7253 Build command line arguments. This method is called by the main command. 7254 7255 Args: 7256 execution: The execution object. 7257 Returns: 7258 Command line arguments 7259 """ 7260 cargs = [] 7261 cargs.extend([ 7262 "-split", 7263 self.split 7264 ]) 7265 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7428@dataclasses.dataclass 7429class C3dSpm: 7430 """ 7431 -spm, -nospm: SPM compatibility in Analyze output 7432 7433 Syntax: `-spm` or `-nospm ` 7434 7435 These options specify whether use the SPM extension to the Analyze 7436 (.hdr,.img) format. When this option is on, the origin field stored by SPM 7437 in the Analyze header will be correctly interpreted. When saving analyze 7438 files, the origin will be set correctly. The default is equivalent to the 7439 **-nospm** option. Best to avoid this issue altogether by using NIFTI and 7440 SPM5 or later. 7441 7442 c3d -spm in.hdr out.img.gz. 7443 """ 7444 spm: str 7445 """-spm, -nospm: SPM compatibility in Analyze output 7446 7447 Syntax: `-spm` or `-nospm ` 7448 7449 These options specify whether use the SPM extension to the Analyze 7450 (.hdr,.img) format. When this option is on, the origin field stored by SPM 7451 in the Analyze header will be correctly interpreted. When saving analyze 7452 files, the origin will be set correctly. The default is equivalent to the 7453 **-nospm** option. Best to avoid this issue altogether by using NIFTI and 7454 SPM5 or later. 7455 7456 c3d -spm in.hdr out.img.gz""" 7457 7458 def run( 7459 self, 7460 execution: Execution, 7461 ) -> list[str]: 7462 """ 7463 Build command line arguments. This method is called by the main command. 7464 7465 Args: 7466 execution: The execution object. 7467 Returns: 7468 Command line arguments 7469 """ 7470 cargs = [] 7471 cargs.extend([ 7472 "-spm", 7473 self.spm 7474 ]) 7475 return cargs
-spm, -nospm: SPM compatibility in Analyze output
Syntax: -spm or -nospm
These options specify whether use the SPM extension to the Analyze (.hdr,.img) format. When this option is on, the origin field stored by SPM in the Analyze header will be correctly interpreted. When saving analyze files, the origin will be set correctly. The default is equivalent to the -nospm option. Best to avoid this issue altogether by using NIFTI and SPM5 or later.
c3d -spm in.hdr out.img.gz.
-spm, -nospm: SPM compatibility in Analyze output
Syntax: -spm or -nospm
These options specify whether use the SPM extension to the Analyze (.hdr,.img) format. When this option is on, the origin field stored by SPM in the Analyze header will be correctly interpreted. When saving analyze files, the origin will be set correctly. The default is equivalent to the -nospm option. Best to avoid this issue altogether by using NIFTI and SPM5 or later.
c3d -spm in.hdr out.img.gz
7458 def run( 7459 self, 7460 execution: Execution, 7461 ) -> list[str]: 7462 """ 7463 Build command line arguments. This method is called by the main command. 7464 7465 Args: 7466 execution: The execution object. 7467 Returns: 7468 Command line arguments 7469 """ 7470 cargs = [] 7471 cargs.extend([ 7472 "-spm", 7473 self.spm 7474 ]) 7475 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7268@dataclasses.dataclass 7269class C3dSqrt: 7270 """ 7271 -sqrt: Take square root of image 7272 7273 Syntax: `-sqrt ` 7274 7275 Computes square root of each voxel in the image. 7276 7277 c3d input.img -sqrt -o output.img. 7278 """ 7279 sqrt: str 7280 """-sqrt: Take square root of image 7281 7282 Syntax: `-sqrt ` 7283 7284 Computes square root of each voxel in the image. 7285 7286 c3d input.img -sqrt -o output.img""" 7287 7288 def run( 7289 self, 7290 execution: Execution, 7291 ) -> list[str]: 7292 """ 7293 Build command line arguments. This method is called by the main command. 7294 7295 Args: 7296 execution: The execution object. 7297 Returns: 7298 Command line arguments 7299 """ 7300 cargs = [] 7301 cargs.extend([ 7302 "-sqrt", 7303 self.sqrt 7304 ]) 7305 return cargs
-sqrt: Take square root of image
Syntax: -sqrt
Computes square root of each voxel in the image.
c3d input.img -sqrt -o output.img.
-sqrt: Take square root of image
Syntax: -sqrt
Computes square root of each voxel in the image.
c3d input.img -sqrt -o output.img
7288 def run( 7289 self, 7290 execution: Execution, 7291 ) -> list[str]: 7292 """ 7293 Build command line arguments. This method is called by the main command. 7294 7295 Args: 7296 execution: The execution object. 7297 Returns: 7298 Command line arguments 7299 """ 7300 cargs = [] 7301 cargs.extend([ 7302 "-sqrt", 7303 self.sqrt 7304 ]) 7305 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7308@dataclasses.dataclass 7309class C3dStaple: 7310 """ 7311 -staple: STAPLE algorithm to combine segmentations 7312 7313 Syntax: `-staple <intensity_value> ` 7314 7315 Runs the ITK implementation of the STAPLE algorithm ([See Paper][11]). 7316 STAPLE generates an estimate of the 'true' segmentation of a structure given 7317 a set of segmentations by different raters. This command treats all images 7318 on the stack as inputs. Each image is considered to be a segmentation by a 7319 different rater. The parameter *intensity_value* specifies the label in the 7320 segmentation images corresponding to the structure of interest (e.g., the 7321 segmentation image may have value 1 corresponding to the caudate and value 2 7322 corresponding to the hippocampus. To run STAPLE on the hippocampus, pass in 7323 2 as the *intensity_value*). The output of STAPLE is a real-valued image 7324 with voxels between 0 and 1, representing the probability of each voxel 7325 being in the 'true' segmentation. This image can be thresholded to get a 7326 binary consensus segmentation. Additional outputs (estimates of the 7327 sensitivity and specificity of each rater) are printed out if the 7328 **-verbose** command is used before the **-staple** command. 7329 7330 c3d -verbose rater1.img rater2.img rater3.img -staple 1 -o probmap.img 7331 c3d -verbose rater*.img -staple 1 -threshold 0.5 inf 1 0 -o bin_segm.img. 7332 """ 7333 staple: str 7334 """-staple: STAPLE algorithm to combine segmentations 7335 7336 Syntax: `-staple <intensity_value> ` 7337 7338 Runs the ITK implementation of the STAPLE algorithm ([See Paper][11]). 7339 STAPLE generates an estimate of the 'true' segmentation of a structure given 7340 a set of segmentations by different raters. This command treats all images 7341 on the stack as inputs. Each image is considered to be a segmentation by a 7342 different rater. The parameter *intensity_value* specifies the label in the 7343 segmentation images corresponding to the structure of interest (e.g., the 7344 segmentation image may have value 1 corresponding to the caudate and value 2 7345 corresponding to the hippocampus. To run STAPLE on the hippocampus, pass in 7346 2 as the *intensity_value*). The output of STAPLE is a real-valued image 7347 with voxels between 0 and 1, representing the probability of each voxel 7348 being in the 'true' segmentation. This image can be thresholded to get a 7349 binary consensus segmentation. Additional outputs (estimates of the 7350 sensitivity and specificity of each rater) are printed out if the 7351 **-verbose** command is used before the **-staple** command. 7352 7353 c3d -verbose rater1.img rater2.img rater3.img -staple 1 -o probmap.img 7354 c3d -verbose rater*.img -staple 1 -threshold 0.5 inf 1 0 -o bin_segm.img""" 7355 7356 def run( 7357 self, 7358 execution: Execution, 7359 ) -> list[str]: 7360 """ 7361 Build command line arguments. This method is called by the main command. 7362 7363 Args: 7364 execution: The execution object. 7365 Returns: 7366 Command line arguments 7367 """ 7368 cargs = [] 7369 cargs.extend([ 7370 "-staple", 7371 self.staple 7372 ]) 7373 return cargs
-staple: STAPLE algorithm to combine segmentations
Syntax: -staple <intensity_value>
Runs the ITK implementation of the STAPLE algorithm ([See Paper][11]). STAPLE generates an estimate of the 'true' segmentation of a structure given a set of segmentations by different raters. This command treats all images on the stack as inputs. Each image is considered to be a segmentation by a different rater. The parameter intensity_value specifies the label in the segmentation images corresponding to the structure of interest (e.g., the segmentation image may have value 1 corresponding to the caudate and value 2 corresponding to the hippocampus. To run STAPLE on the hippocampus, pass in 2 as the intensity_value). The output of STAPLE is a real-valued image with voxels between 0 and 1, representing the probability of each voxel being in the 'true' segmentation. This image can be thresholded to get a binary consensus segmentation. Additional outputs (estimates of the sensitivity and specificity of each rater) are printed out if the -verbose command is used before the -staple command.
c3d -verbose rater1.img rater2.img rater3.img -staple 1 -o probmap.img c3d -verbose rater*.img -staple 1 -threshold 0.5 inf 1 0 -o bin_segm.img.
-staple: STAPLE algorithm to combine segmentations
Syntax: -staple <intensity_value>
Runs the ITK implementation of the STAPLE algorithm ([See Paper][11]). STAPLE generates an estimate of the 'true' segmentation of a structure given a set of segmentations by different raters. This command treats all images on the stack as inputs. Each image is considered to be a segmentation by a different rater. The parameter intensity_value specifies the label in the segmentation images corresponding to the structure of interest (e.g., the segmentation image may have value 1 corresponding to the caudate and value 2 corresponding to the hippocampus. To run STAPLE on the hippocampus, pass in 2 as the intensity_value). The output of STAPLE is a real-valued image with voxels between 0 and 1, representing the probability of each voxel being in the 'true' segmentation. This image can be thresholded to get a binary consensus segmentation. Additional outputs (estimates of the sensitivity and specificity of each rater) are printed out if the -verbose command is used before the -staple command.
c3d -verbose rater1.img rater2.img rater3.img -staple 1 -o probmap.img c3d -verbose rater*.img -staple 1 -threshold 0.5 inf 1 0 -o bin_segm.img
7356 def run( 7357 self, 7358 execution: Execution, 7359 ) -> list[str]: 7360 """ 7361 Build command line arguments. This method is called by the main command. 7362 7363 Args: 7364 execution: The execution object. 7365 Returns: 7366 Command line arguments 7367 """ 7368 cargs = [] 7369 cargs.extend([ 7370 "-staple", 7371 self.staple 7372 ]) 7373 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7534@dataclasses.dataclass 7535class C3dStretch: 7536 """ 7537 -stretch: Stretch image intensities linearly 7538 7539 Syntax: `-stretch <u1 u2 v1 v2> ` 7540 7541 Stretches the intensities in the image linearly, such that u1 maps to v1 and 7542 u2 maps to v2. The linear transformation is applied to all intensities in 7543 the image, whether inside the range or not. For example, to map a floating 7544 point image with intensities in interval (0,1) to the full range of an 7545 unsigned short image, use 7546 7547 c3d input.img -stretch 0.0 1.0 0 65535 -type ushort -o output.img. 7548 """ 7549 stretch: str 7550 """-stretch: Stretch image intensities linearly 7551 7552 Syntax: `-stretch <u1 u2 v1 v2> ` 7553 7554 Stretches the intensities in the image linearly, such that u1 maps to v1 and 7555 u2 maps to v2. The linear transformation is applied to all intensities in 7556 the image, whether inside the range or not. For example, to map a floating 7557 point image with intensities in interval (0,1) to the full range of an 7558 unsigned short image, use 7559 7560 c3d input.img -stretch 0.0 1.0 0 65535 -type ushort -o output.img""" 7561 7562 def run( 7563 self, 7564 execution: Execution, 7565 ) -> list[str]: 7566 """ 7567 Build command line arguments. This method is called by the main command. 7568 7569 Args: 7570 execution: The execution object. 7571 Returns: 7572 Command line arguments 7573 """ 7574 cargs = [] 7575 cargs.extend([ 7576 "-stretch", 7577 self.stretch 7578 ]) 7579 return cargs
-stretch: Stretch image intensities linearly
Syntax: -stretch <u1 u2 v1 v2>
Stretches the intensities in the image linearly, such that u1 maps to v1 and u2 maps to v2. The linear transformation is applied to all intensities in the image, whether inside the range or not. For example, to map a floating point image with intensities in interval (0,1) to the full range of an unsigned short image, use
c3d input.img -stretch 0.0 1.0 0 65535 -type ushort -o output.img.
-stretch: Stretch image intensities linearly
Syntax: -stretch <u1 u2 v1 v2>
Stretches the intensities in the image linearly, such that u1 maps to v1 and u2 maps to v2. The linear transformation is applied to all intensities in the image, whether inside the range or not. For example, to map a floating point image with intensities in interval (0,1) to the full range of an unsigned short image, use
c3d input.img -stretch 0.0 1.0 0 65535 -type ushort -o output.img
7562 def run( 7563 self, 7564 execution: Execution, 7565 ) -> list[str]: 7566 """ 7567 Build command line arguments. This method is called by the main command. 7568 7569 Args: 7570 execution: The execution object. 7571 Returns: 7572 Command line arguments 7573 """ 7574 cargs = [] 7575 cargs.extend([ 7576 "-stretch", 7577 self.stretch 7578 ]) 7579 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7376@dataclasses.dataclass 7377class C3dStructureTensorEigenvalues: 7378 """ 7379 -steig, -structure-tensor-eigenvalues: Compute eigenvalues of the structure 7380 tensor 7381 7382 Syntax `-steig <scale> <radius>` 7383 7384 Computes the Hessian matrix at every pixel of an image and the eigenvalues 7385 of the Hessian. Images of the eigenvalues (sorted by value) are placed on 7386 the stack. These images are useful as texture features. See also the 7387 '''-steig''' command. The scale determines the amount of Gaussian smoothing 7388 applied for computing the partial derivatives in the Hessian, and is in 7389 physical (mm) units. 7390 7391 c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz. 7392 """ 7393 structure_tensor_eigenvalues: str 7394 """-steig, -structure-tensor-eigenvalues: Compute eigenvalues of the 7395 structure tensor 7396 7397 Syntax `-steig <scale> <radius>` 7398 7399 Computes the Hessian matrix at every pixel of an image and the eigenvalues 7400 of the Hessian. Images of the eigenvalues (sorted by value) are placed on 7401 the stack. These images are useful as texture features. See also the 7402 '''-steig''' command. The scale determines the amount of Gaussian smoothing 7403 applied for computing the partial derivatives in the Hessian, and is in 7404 physical (mm) units. 7405 7406 c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz""" 7407 7408 def run( 7409 self, 7410 execution: Execution, 7411 ) -> list[str]: 7412 """ 7413 Build command line arguments. This method is called by the main command. 7414 7415 Args: 7416 execution: The execution object. 7417 Returns: 7418 Command line arguments 7419 """ 7420 cargs = [] 7421 cargs.extend([ 7422 "-steig", 7423 self.structure_tensor_eigenvalues 7424 ]) 7425 return cargs
-steig, -structure-tensor-eigenvalues: Compute eigenvalues of the structure tensor
Syntax -steig <scale> <radius>
Computes the Hessian matrix at every pixel of an image and the eigenvalues of the Hessian. Images of the eigenvalues (sorted by value) are placed on the stack. These images are useful as texture features. See also the '''-steig''' command. The scale determines the amount of Gaussian smoothing applied for computing the partial derivatives in the Hessian, and is in physical (mm) units.
c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz.
-steig, -structure-tensor-eigenvalues: Compute eigenvalues of the structure tensor
Syntax -steig <scale> <radius>
Computes the Hessian matrix at every pixel of an image and the eigenvalues of the Hessian. Images of the eigenvalues (sorted by value) are placed on the stack. These images are useful as texture features. See also the '''-steig''' command. The scale determines the amount of Gaussian smoothing applied for computing the partial derivatives in the Hessian, and is in physical (mm) units.
c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz
7408 def run( 7409 self, 7410 execution: Execution, 7411 ) -> list[str]: 7412 """ 7413 Build command line arguments. This method is called by the main command. 7414 7415 Args: 7416 execution: The execution object. 7417 Returns: 7418 Command line arguments 7419 """ 7420 cargs = [] 7421 cargs.extend([ 7422 "-steig", 7423 self.structure_tensor_eigenvalues 7424 ]) 7425 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7478@dataclasses.dataclass 7479class C3dSubtract: 7480 """ 7481 No description found. 7482 """ 7483 subtract: str 7484 """No description found.""" 7485 7486 def run( 7487 self, 7488 execution: Execution, 7489 ) -> list[str]: 7490 """ 7491 Build command line arguments. This method is called by the main command. 7492 7493 Args: 7494 execution: The execution object. 7495 Returns: 7496 Command line arguments 7497 """ 7498 cargs = [] 7499 cargs.extend([ 7500 "-subtract", 7501 self.subtract 7502 ]) 7503 return cargs
No description found.
7486 def run( 7487 self, 7488 execution: Execution, 7489 ) -> list[str]: 7490 """ 7491 Build command line arguments. This method is called by the main command. 7492 7493 Args: 7494 execution: The execution object. 7495 Returns: 7496 Command line arguments 7497 """ 7498 cargs = [] 7499 cargs.extend([ 7500 "-subtract", 7501 self.subtract 7502 ]) 7503 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7506@dataclasses.dataclass 7507class C3dSupervoxel: 7508 """ 7509 No description found. 7510 """ 7511 supervoxel: str 7512 """No description found.""" 7513 7514 def run( 7515 self, 7516 execution: Execution, 7517 ) -> list[str]: 7518 """ 7519 Build command line arguments. This method is called by the main command. 7520 7521 Args: 7522 execution: The execution object. 7523 Returns: 7524 Command line arguments 7525 """ 7526 cargs = [] 7527 cargs.extend([ 7528 "-supervoxel", 7529 self.supervoxel 7530 ]) 7531 return cargs
No description found.
7514 def run( 7515 self, 7516 execution: Execution, 7517 ) -> list[str]: 7518 """ 7519 Build command line arguments. This method is called by the main command. 7520 7521 Args: 7522 execution: The execution object. 7523 Returns: 7524 Command line arguments 7525 """ 7526 cargs = [] 7527 cargs.extend([ 7528 "-supervoxel", 7529 self.supervoxel 7530 ]) 7531 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7582@dataclasses.dataclass 7583class C3dSwapdim: 7584 """ 7585 -swapdim: Reorder the coordinate axes of an image 7586 7587 Syntax `-swapdim <code>` 7588 7589 This command reorders the image axes (columns, rows, slices) to achieve a 7590 desired transformation between voxel space and physical space. The image 7591 remains exactly the same in physical space, but the encoding of the voxels 7592 in memory and on disk is changed to obtain the desired transformation. The 7593 transformation is specified as a three-letter 'RAI' code, as in the 7594 '''-orient''' command. 7595 7596 c3d img.nii -swapdim ASL -info -o out.nii 7597 7598 7599 ### Commands: Image Processing 7600 7601 The following commands invoke an action that is applied to images. Unary 7602 commands apply the action to the last image on the stack, binary commands 7603 apply to the last two images and so on. Commands are affected by options, 7604 which are listed separately. 7605 """ 7606 swapdim: str 7607 """-swapdim: Reorder the coordinate axes of an image 7608 7609 Syntax `-swapdim <code>` 7610 7611 This command reorders the image axes (columns, rows, slices) to achieve a 7612 desired transformation between voxel space and physical space. The image 7613 remains exactly the same in physical space, but the encoding of the voxels 7614 in memory and on disk is changed to obtain the desired transformation. The 7615 transformation is specified as a three-letter 'RAI' code, as in the 7616 '''-orient''' command. 7617 7618 c3d img.nii -swapdim ASL -info -o out.nii 7619 7620 7621 ### Commands: Image Processing 7622 7623 The following commands invoke an action that is applied to images. Unary 7624 commands apply the action to the last image on the stack, binary commands 7625 apply to the last two images and so on. Commands are affected by options, 7626 which are listed separately.""" 7627 7628 def run( 7629 self, 7630 execution: Execution, 7631 ) -> list[str]: 7632 """ 7633 Build command line arguments. This method is called by the main command. 7634 7635 Args: 7636 execution: The execution object. 7637 Returns: 7638 Command line arguments 7639 """ 7640 cargs = [] 7641 cargs.extend([ 7642 "-swapdim", 7643 self.swapdim 7644 ]) 7645 return cargs
-swapdim: Reorder the coordinate axes of an image
Syntax -swapdim <code>
This command reorders the image axes (columns, rows, slices) to achieve a desired transformation between voxel space and physical space. The image remains exactly the same in physical space, but the encoding of the voxels in memory and on disk is changed to obtain the desired transformation. The transformation is specified as a three-letter 'RAI' code, as in the '''-orient''' command.
c3d img.nii -swapdim ASL -info -o out.nii
Commands: Image Processing
The following commands invoke an action that is applied to images. Unary commands apply the action to the last image on the stack, binary commands apply to the last two images and so on. Commands are affected by options, which are listed separately.
-swapdim: Reorder the coordinate axes of an image
Syntax -swapdim <code>
This command reorders the image axes (columns, rows, slices) to achieve a desired transformation between voxel space and physical space. The image remains exactly the same in physical space, but the encoding of the voxels in memory and on disk is changed to obtain the desired transformation. The transformation is specified as a three-letter 'RAI' code, as in the '''-orient''' command.
c3d img.nii -swapdim ASL -info -o out.nii
Commands: Image Processing
The following commands invoke an action that is applied to images. Unary commands apply the action to the last image on the stack, binary commands apply to the last two images and so on. Commands are affected by options, which are listed separately.
7628 def run( 7629 self, 7630 execution: Execution, 7631 ) -> list[str]: 7632 """ 7633 Build command line arguments. This method is called by the main command. 7634 7635 Args: 7636 execution: The execution object. 7637 Returns: 7638 Command line arguments 7639 """ 7640 cargs = [] 7641 cargs.extend([ 7642 "-swapdim", 7643 self.swapdim 7644 ]) 7645 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7648@dataclasses.dataclass 7649class C3dTestImage: 7650 """ 7651 -test-image, -test-probe: Test condition 7652 7653 Syntax: `-test-image [tolerance]` and `-test-probe <vector> <value> 7654 [tolerance]` 7655 7656 These advanced commands (with more to come in the future) are primarily 7657 meant to allow testing of **c3d**. However, they can also be used for flow 7658 control in shell scripts (e.g., **bash** shell). The commands check a 7659 certain aspect of the **c3d** state and cause the program to exit with 7660 either return code 0 if the test succeeded or a non-zero return code if the 7661 test failed. 7662 7663 **-test-image** tests if the last two images on the stack are identical 7664 (both in terms of data and header). Returns 0 if the images are identical. 7665 The optional tolerance parameter has default value 1e-8. 7666 7667 c3d input1.img input2.img -test-image 7668 7669 **-test-probe** is similar to the **-probe** command. It tests if the value 7670 of the last image on the stack at the position given by **vector** is equal 7671 to the **test_value**. An optional tolerance value may be specified, the 7672 default is 1e-8. 7673 7674 c3d input1.img -test-probe 40x40x20vox 1.0 1e-6. 7675 """ 7676 test_image: str 7677 """-test-image, -test-probe: Test condition 7678 7679 Syntax: `-test-image [tolerance]` and `-test-probe <vector> <value> 7680 [tolerance]` 7681 7682 These advanced commands (with more to come in the future) are primarily 7683 meant to allow testing of **c3d**. However, they can also be used for flow 7684 control in shell scripts (e.g., **bash** shell). The commands check a 7685 certain aspect of the **c3d** state and cause the program to exit with 7686 either return code 0 if the test succeeded or a non-zero return code if the 7687 test failed. 7688 7689 **-test-image** tests if the last two images on the stack are identical 7690 (both in terms of data and header). Returns 0 if the images are identical. 7691 The optional tolerance parameter has default value 1e-8. 7692 7693 c3d input1.img input2.img -test-image 7694 7695 **-test-probe** is similar to the **-probe** command. It tests if the value 7696 of the last image on the stack at the position given by **vector** is equal 7697 to the **test_value**. An optional tolerance value may be specified, the 7698 default is 1e-8. 7699 7700 c3d input1.img -test-probe 40x40x20vox 1.0 1e-6""" 7701 7702 def run( 7703 self, 7704 execution: Execution, 7705 ) -> list[str]: 7706 """ 7707 Build command line arguments. This method is called by the main command. 7708 7709 Args: 7710 execution: The execution object. 7711 Returns: 7712 Command line arguments 7713 """ 7714 cargs = [] 7715 cargs.extend([ 7716 "-test-image", 7717 self.test_image 7718 ]) 7719 return cargs
-test-image, -test-probe: Test condition
Syntax: -test-image [tolerance] and -test-probe <vector> <value>
[tolerance]
These advanced commands (with more to come in the future) are primarily meant to allow testing of c3d. However, they can also be used for flow control in shell scripts (e.g., bash shell). The commands check a certain aspect of the c3d state and cause the program to exit with either return code 0 if the test succeeded or a non-zero return code if the test failed.
-test-image tests if the last two images on the stack are identical (both in terms of data and header). Returns 0 if the images are identical. The optional tolerance parameter has default value 1e-8.
c3d input1.img input2.img -test-image
-test-probe is similar to the -probe command. It tests if the value of the last image on the stack at the position given by vector is equal to the test_value. An optional tolerance value may be specified, the default is 1e-8.
c3d input1.img -test-probe 40x40x20vox 1.0 1e-6.
-test-image, -test-probe: Test condition
Syntax: -test-image [tolerance] and -test-probe <vector> <value>
[tolerance]
These advanced commands (with more to come in the future) are primarily meant to allow testing of c3d. However, they can also be used for flow control in shell scripts (e.g., bash shell). The commands check a certain aspect of the c3d state and cause the program to exit with either return code 0 if the test succeeded or a non-zero return code if the test failed.
-test-image tests if the last two images on the stack are identical (both in terms of data and header). Returns 0 if the images are identical. The optional tolerance parameter has default value 1e-8.
c3d input1.img input2.img -test-image
-test-probe is similar to the -probe command. It tests if the value of the last image on the stack at the position given by vector is equal to the test_value. An optional tolerance value may be specified, the default is 1e-8.
c3d input1.img -test-probe 40x40x20vox 1.0 1e-6
7702 def run( 7703 self, 7704 execution: Execution, 7705 ) -> list[str]: 7706 """ 7707 Build command line arguments. This method is called by the main command. 7708 7709 Args: 7710 execution: The execution object. 7711 Returns: 7712 Command line arguments 7713 """ 7714 cargs = [] 7715 cargs.extend([ 7716 "-test-image", 7717 self.test_image 7718 ]) 7719 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7722@dataclasses.dataclass 7723class C3dTestProbe: 7724 """ 7725 -test-image, -test-probe: Test condition 7726 7727 Syntax: `-test-image [tolerance]` and `-test-probe <vector> <value> 7728 [tolerance]` 7729 7730 These advanced commands (with more to come in the future) are primarily 7731 meant to allow testing of **c3d**. However, they can also be used for flow 7732 control in shell scripts (e.g., **bash** shell). The commands check a 7733 certain aspect of the **c3d** state and cause the program to exit with 7734 either return code 0 if the test succeeded or a non-zero return code if the 7735 test failed. 7736 7737 **-test-image** tests if the last two images on the stack are identical 7738 (both in terms of data and header). Returns 0 if the images are identical. 7739 The optional tolerance parameter has default value 1e-8. 7740 7741 c3d input1.img input2.img -test-image 7742 7743 **-test-probe** is similar to the **-probe** command. It tests if the value 7744 of the last image on the stack at the position given by **vector** is equal 7745 to the **test_value**. An optional tolerance value may be specified, the 7746 default is 1e-8. 7747 7748 c3d input1.img -test-probe 40x40x20vox 1.0 1e-6. 7749 """ 7750 test_probe: str 7751 """-test-image, -test-probe: Test condition 7752 7753 Syntax: `-test-image [tolerance]` and `-test-probe <vector> <value> 7754 [tolerance]` 7755 7756 These advanced commands (with more to come in the future) are primarily 7757 meant to allow testing of **c3d**. However, they can also be used for flow 7758 control in shell scripts (e.g., **bash** shell). The commands check a 7759 certain aspect of the **c3d** state and cause the program to exit with 7760 either return code 0 if the test succeeded or a non-zero return code if the 7761 test failed. 7762 7763 **-test-image** tests if the last two images on the stack are identical 7764 (both in terms of data and header). Returns 0 if the images are identical. 7765 The optional tolerance parameter has default value 1e-8. 7766 7767 c3d input1.img input2.img -test-image 7768 7769 **-test-probe** is similar to the **-probe** command. It tests if the value 7770 of the last image on the stack at the position given by **vector** is equal 7771 to the **test_value**. An optional tolerance value may be specified, the 7772 default is 1e-8. 7773 7774 c3d input1.img -test-probe 40x40x20vox 1.0 1e-6""" 7775 7776 def run( 7777 self, 7778 execution: Execution, 7779 ) -> list[str]: 7780 """ 7781 Build command line arguments. This method is called by the main command. 7782 7783 Args: 7784 execution: The execution object. 7785 Returns: 7786 Command line arguments 7787 """ 7788 cargs = [] 7789 cargs.extend([ 7790 "-test-probe", 7791 self.test_probe 7792 ]) 7793 return cargs
-test-image, -test-probe: Test condition
Syntax: -test-image [tolerance] and -test-probe <vector> <value>
[tolerance]
These advanced commands (with more to come in the future) are primarily meant to allow testing of c3d. However, they can also be used for flow control in shell scripts (e.g., bash shell). The commands check a certain aspect of the c3d state and cause the program to exit with either return code 0 if the test succeeded or a non-zero return code if the test failed.
-test-image tests if the last two images on the stack are identical (both in terms of data and header). Returns 0 if the images are identical. The optional tolerance parameter has default value 1e-8.
c3d input1.img input2.img -test-image
-test-probe is similar to the -probe command. It tests if the value of the last image on the stack at the position given by vector is equal to the test_value. An optional tolerance value may be specified, the default is 1e-8.
c3d input1.img -test-probe 40x40x20vox 1.0 1e-6.
-test-image, -test-probe: Test condition
Syntax: -test-image [tolerance] and -test-probe <vector> <value>
[tolerance]
These advanced commands (with more to come in the future) are primarily meant to allow testing of c3d. However, they can also be used for flow control in shell scripts (e.g., bash shell). The commands check a certain aspect of the c3d state and cause the program to exit with either return code 0 if the test succeeded or a non-zero return code if the test failed.
-test-image tests if the last two images on the stack are identical (both in terms of data and header). Returns 0 if the images are identical. The optional tolerance parameter has default value 1e-8.
c3d input1.img input2.img -test-image
-test-probe is similar to the -probe command. It tests if the value of the last image on the stack at the position given by vector is equal to the test_value. An optional tolerance value may be specified, the default is 1e-8.
c3d input1.img -test-probe 40x40x20vox 1.0 1e-6
7776 def run( 7777 self, 7778 execution: Execution, 7779 ) -> list[str]: 7780 """ 7781 Build command line arguments. This method is called by the main command. 7782 7783 Args: 7784 execution: The execution object. 7785 Returns: 7786 Command line arguments 7787 """ 7788 cargs = [] 7789 cargs.extend([ 7790 "-test-probe", 7791 self.test_probe 7792 ]) 7793 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7796@dataclasses.dataclass 7797class C3dThreshold: 7798 """ 7799 -thresh, -threshold: Binary thresholding 7800 7801 Syntax: `-thresh <u1 u2 vIn vOut> ` 7802 7803 Thresholds the image, setting voxels whose intensity is in the range [u1,u2] 7804 to vIn and all other voxels to vOut. Values *u1* and *u2* are intensity 7805 specifications (see below). This means that you can supply values **inf** 7806 and **-inf** for u1 and u2 to construct a one-sided threshold. You can also 7807 specify *u1* and *u2* as percentiles. 7808 c3d in.img -threshold -inf 128 1 0 -o out.img 7809 c3d in.img -threshold 64 128 1 0 -o out.img 7810 c3d in.img -threshold 20% 40% 1 0 -o out.img. 7811 """ 7812 threshold: str 7813 """-thresh, -threshold: Binary thresholding 7814 7815 Syntax: `-thresh <u1 u2 vIn vOut> ` 7816 7817 Thresholds the image, setting voxels whose intensity is in the range [u1,u2] 7818 to vIn and all other voxels to vOut. Values *u1* and *u2* are intensity 7819 specifications (see below). This means that you can supply values **inf** 7820 and **-inf** for u1 and u2 to construct a one-sided threshold. You can also 7821 specify *u1* and *u2* as percentiles. 7822 c3d in.img -threshold -inf 128 1 0 -o out.img 7823 c3d in.img -threshold 64 128 1 0 -o out.img 7824 c3d in.img -threshold 20% 40% 1 0 -o out.img""" 7825 7826 def run( 7827 self, 7828 execution: Execution, 7829 ) -> list[str]: 7830 """ 7831 Build command line arguments. This method is called by the main command. 7832 7833 Args: 7834 execution: The execution object. 7835 Returns: 7836 Command line arguments 7837 """ 7838 cargs = [] 7839 cargs.extend([ 7840 "-threshold", 7841 self.threshold 7842 ]) 7843 return cargs
-thresh, -threshold: Binary thresholding
Syntax: -thresh <u1 u2 vIn vOut>
Thresholds the image, setting voxels whose intensity is in the range [u1,u2] to vIn and all other voxels to vOut. Values u1 and u2 are intensity specifications (see below). This means that you can supply values inf and -inf for u1 and u2 to construct a one-sided threshold. You can also specify u1 and u2 as percentiles. c3d in.img -threshold -inf 128 1 0 -o out.img c3d in.img -threshold 64 128 1 0 -o out.img c3d in.img -threshold 20% 40% 1 0 -o out.img.
-thresh, -threshold: Binary thresholding
Syntax: -thresh <u1 u2 vIn vOut>
Thresholds the image, setting voxels whose intensity is in the range [u1,u2] to vIn and all other voxels to vOut. Values u1 and u2 are intensity specifications (see below). This means that you can supply values inf and -inf for u1 and u2 to construct a one-sided threshold. You can also specify u1 and u2 as percentiles. c3d in.img -threshold -inf 128 1 0 -o out.img c3d in.img -threshold 64 128 1 0 -o out.img c3d in.img -threshold 20% 40% 1 0 -o out.img
7826 def run( 7827 self, 7828 execution: Execution, 7829 ) -> list[str]: 7830 """ 7831 Build command line arguments. This method is called by the main command. 7832 7833 Args: 7834 execution: The execution object. 7835 Returns: 7836 Command line arguments 7837 """ 7838 cargs = [] 7839 cargs.extend([ 7840 "-threshold", 7841 self.threshold 7842 ]) 7843 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7846@dataclasses.dataclass 7847class C3dTile: 7848 """ 7849 -tile: Tile and stack multiple images into one 7850 7851 Syntax: `-tile <tile_spec>` 7852 7853 Tiles multiple images into a single image -- including stacking slices into 7854 a 3D volume. The command takes all images on the stack and produces a single 7855 tiled image. The **tile_spec** parameter can either specify a coordinate 7856 axis (x, y, or z) along which to tile the images, or a layout vector (e.g., 7857 **4x4**) which specifies the tiling along each coordinate. Passing 0 for the 7858 last value in the layout vector determines the value based on the number of 7859 images currently loaded. For example, to create a 3D volume from a set of 7860 slices, we use 7861 7862 c3d slices*.png -tile z -o volume.nii.gz 7863 7864 And to arrange the same 2D slices into a 2D montage of 4 images per row, we 7865 would use the **c2d** command as follows: 7866 7867 c2d slices*.png -tile 4x0 -type uchar -o montage.png. 7868 """ 7869 tile: str 7870 """-tile: Tile and stack multiple images into one 7871 7872 Syntax: `-tile <tile_spec>` 7873 7874 Tiles multiple images into a single image -- including stacking slices into 7875 a 3D volume. The command takes all images on the stack and produces a single 7876 tiled image. The **tile_spec** parameter can either specify a coordinate 7877 axis (x, y, or z) along which to tile the images, or a layout vector (e.g., 7878 **4x4**) which specifies the tiling along each coordinate. Passing 0 for the 7879 last value in the layout vector determines the value based on the number of 7880 images currently loaded. For example, to create a 3D volume from a set of 7881 slices, we use 7882 7883 c3d slices*.png -tile z -o volume.nii.gz 7884 7885 And to arrange the same 2D slices into a 2D montage of 4 images per row, we 7886 would use the **c2d** command as follows: 7887 7888 c2d slices*.png -tile 4x0 -type uchar -o montage.png""" 7889 7890 def run( 7891 self, 7892 execution: Execution, 7893 ) -> list[str]: 7894 """ 7895 Build command line arguments. This method is called by the main command. 7896 7897 Args: 7898 execution: The execution object. 7899 Returns: 7900 Command line arguments 7901 """ 7902 cargs = [] 7903 cargs.extend([ 7904 "-tile", 7905 self.tile 7906 ]) 7907 return cargs
-tile: Tile and stack multiple images into one
Syntax: -tile <tile_spec>
Tiles multiple images into a single image -- including stacking slices into a 3D volume. The command takes all images on the stack and produces a single tiled image. The tile_spec parameter can either specify a coordinate axis (x, y, or z) along which to tile the images, or a layout vector (e.g., 4x4) which specifies the tiling along each coordinate. Passing 0 for the last value in the layout vector determines the value based on the number of images currently loaded. For example, to create a 3D volume from a set of slices, we use
c3d slices*.png -tile z -o volume.nii.gz
And to arrange the same 2D slices into a 2D montage of 4 images per row, we would use the c2d command as follows:
c2d slices*.png -tile 4x0 -type uchar -o montage.png.
-tile: Tile and stack multiple images into one
Syntax: -tile <tile_spec>
Tiles multiple images into a single image -- including stacking slices into a 3D volume. The command takes all images on the stack and produces a single tiled image. The tile_spec parameter can either specify a coordinate axis (x, y, or z) along which to tile the images, or a layout vector (e.g., 4x4) which specifies the tiling along each coordinate. Passing 0 for the last value in the layout vector determines the value based on the number of images currently loaded. For example, to create a 3D volume from a set of slices, we use
c3d slices*.png -tile z -o volume.nii.gz
And to arrange the same 2D slices into a 2D montage of 4 images per row, we would use the c2d command as follows:
c2d slices*.png -tile 4x0 -type uchar -o montage.png
7890 def run( 7891 self, 7892 execution: Execution, 7893 ) -> list[str]: 7894 """ 7895 Build command line arguments. This method is called by the main command. 7896 7897 Args: 7898 execution: The execution object. 7899 Returns: 7900 Command line arguments 7901 """ 7902 cargs = [] 7903 cargs.extend([ 7904 "-tile", 7905 self.tile 7906 ]) 7907 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7910@dataclasses.dataclass 7911class C3dTrim: 7912 """ 7913 -trim: Trim background region of image 7914 7915 Syntax: `-trim <margin_vector>` 7916 7917 Use this command to trim background in an image. When most of the image is 7918 filled by background, this command will find the smallest rectangular region 7919 that contains all of the non-background voxels in the image. I will then 7920 expand this region by the margin of the size specified, and return the 7921 resulting region as the new image. For example, this command will trim an 7922 image, leaving a 5-voxel margin of background values on all sides 7923 7924 c3d in.img -trim 5vox -o out.img. 7925 """ 7926 trim: str 7927 """-trim: Trim background region of image 7928 7929 Syntax: `-trim <margin_vector>` 7930 7931 Use this command to trim background in an image. When most of the image is 7932 filled by background, this command will find the smallest rectangular region 7933 that contains all of the non-background voxels in the image. I will then 7934 expand this region by the margin of the size specified, and return the 7935 resulting region as the new image. For example, this command will trim an 7936 image, leaving a 5-voxel margin of background values on all sides 7937 7938 c3d in.img -trim 5vox -o out.img""" 7939 7940 def run( 7941 self, 7942 execution: Execution, 7943 ) -> list[str]: 7944 """ 7945 Build command line arguments. This method is called by the main command. 7946 7947 Args: 7948 execution: The execution object. 7949 Returns: 7950 Command line arguments 7951 """ 7952 cargs = [] 7953 cargs.extend([ 7954 "-trim", 7955 self.trim 7956 ]) 7957 return cargs
-trim: Trim background region of image
Syntax: -trim <margin_vector>
Use this command to trim background in an image. When most of the image is filled by background, this command will find the smallest rectangular region that contains all of the non-background voxels in the image. I will then expand this region by the margin of the size specified, and return the resulting region as the new image. For example, this command will trim an image, leaving a 5-voxel margin of background values on all sides
c3d in.img -trim 5vox -o out.img.
-trim: Trim background region of image
Syntax: -trim <margin_vector>
Use this command to trim background in an image. When most of the image is filled by background, this command will find the smallest rectangular region that contains all of the non-background voxels in the image. I will then expand this region by the margin of the size specified, and return the resulting region as the new image. For example, this command will trim an image, leaving a 5-voxel margin of background values on all sides
c3d in.img -trim 5vox -o out.img
7940 def run( 7941 self, 7942 execution: Execution, 7943 ) -> list[str]: 7944 """ 7945 Build command line arguments. This method is called by the main command. 7946 7947 Args: 7948 execution: The execution object. 7949 Returns: 7950 Command line arguments 7951 """ 7952 cargs = [] 7953 cargs.extend([ 7954 "-trim", 7955 self.trim 7956 ]) 7957 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7960@dataclasses.dataclass 7961class C3dTrimToSize: 7962 """ 7963 -trim-to-size: Trim image to given size 7964 7965 Syntax: `-trim-to-size <size_vector>` 7966 7967 Like **-trim**, this command trims the background in an image. However, 7968 instead of **-trim**, you specify the target size of the output region. The 7969 actual region may be smaller if the specified region falls outside the 7970 boundaries of the input image. For example, if you want a 64x64x128 image 7971 containing all the foreground pixels in your image, call 7972 7973 c3d in.img -trim-to-size 64x64x128vox -o out.img. 7974 """ 7975 trim_to_size: str 7976 """-trim-to-size: Trim image to given size 7977 7978 Syntax: `-trim-to-size <size_vector>` 7979 7980 Like **-trim**, this command trims the background in an image. However, 7981 instead of **-trim**, you specify the target size of the output region. The 7982 actual region may be smaller if the specified region falls outside the 7983 boundaries of the input image. For example, if you want a 64x64x128 image 7984 containing all the foreground pixels in your image, call 7985 7986 c3d in.img -trim-to-size 64x64x128vox -o out.img""" 7987 7988 def run( 7989 self, 7990 execution: Execution, 7991 ) -> list[str]: 7992 """ 7993 Build command line arguments. This method is called by the main command. 7994 7995 Args: 7996 execution: The execution object. 7997 Returns: 7998 Command line arguments 7999 """ 8000 cargs = [] 8001 cargs.extend([ 8002 "-trim-to-size", 8003 self.trim_to_size 8004 ]) 8005 return cargs
-trim-to-size: Trim image to given size
Syntax: -trim-to-size <size_vector>
Like -trim, this command trims the background in an image. However, instead of -trim, you specify the target size of the output region. The actual region may be smaller if the specified region falls outside the boundaries of the input image. For example, if you want a 64x64x128 image containing all the foreground pixels in your image, call
c3d in.img -trim-to-size 64x64x128vox -o out.img.
-trim-to-size: Trim image to given size
Syntax: -trim-to-size <size_vector>
Like -trim, this command trims the background in an image. However, instead of -trim, you specify the target size of the output region. The actual region may be smaller if the specified region falls outside the boundaries of the input image. For example, if you want a 64x64x128 image containing all the foreground pixels in your image, call
c3d in.img -trim-to-size 64x64x128vox -o out.img
7988 def run( 7989 self, 7990 execution: Execution, 7991 ) -> list[str]: 7992 """ 7993 Build command line arguments. This method is called by the main command. 7994 7995 Args: 7996 execution: The execution object. 7997 Returns: 7998 Command line arguments 7999 """ 8000 cargs = [] 8001 cargs.extend([ 8002 "-trim-to-size", 8003 self.trim_to_size 8004 ]) 8005 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8008@dataclasses.dataclass 8009class C3dType: 8010 """ 8011 -type: Specify pixel type for image output 8012 8013 Syntax: `-type < char | uchar | short | ushort | int | uint | float | double 8014 > ` 8015 8016 Specifies the pixel type for the output image. By default, images are 8017 written in floating point (**float**) format. The type does not affect how 8018 images are processed, only how they are saved. 8019 8020 c3d image1.img -type short image2.img 8021 8022 Some images require data in certain types. For example, to save PNG images, 8023 uchar or ushort type must be specified. 8024 """ 8025 type_: str 8026 """-type: Specify pixel type for image output 8027 8028 Syntax: `-type < char | uchar | short | ushort | int | uint | float | double 8029 > ` 8030 8031 Specifies the pixel type for the output image. By default, images are 8032 written in floating point (**float**) format. The type does not affect how 8033 images are processed, only how they are saved. 8034 8035 c3d image1.img -type short image2.img 8036 8037 Some images require data in certain types. For example, to save PNG images, 8038 uchar or ushort type must be specified.""" 8039 8040 def run( 8041 self, 8042 execution: Execution, 8043 ) -> list[str]: 8044 """ 8045 Build command line arguments. This method is called by the main command. 8046 8047 Args: 8048 execution: The execution object. 8049 Returns: 8050 Command line arguments 8051 """ 8052 cargs = [] 8053 cargs.extend([ 8054 "-type", 8055 self.type_ 8056 ]) 8057 return cargs
-type: Specify pixel type for image output
Syntax: `-type < char | uchar | short | ushort | int | uint | float | double
`
Specifies the pixel type for the output image. By default, images are written in floating point (float) format. The type does not affect how images are processed, only how they are saved.
c3d image1.img -type short image2.img
Some images require data in certain types. For example, to save PNG images, uchar or ushort type must be specified.
-type: Specify pixel type for image output
Syntax: `-type < char | uchar | short | ushort | int | uint | float | double
`
Specifies the pixel type for the output image. By default, images are written in floating point (float) format. The type does not affect how images are processed, only how they are saved.
c3d image1.img -type short image2.img
Some images require data in certain types. For example, to save PNG images, uchar or ushort type must be specified.
8040 def run( 8041 self, 8042 execution: Execution, 8043 ) -> list[str]: 8044 """ 8045 Build command line arguments. This method is called by the main command. 8046 8047 Args: 8048 execution: The execution object. 8049 Returns: 8050 Command line arguments 8051 """ 8052 cargs = [] 8053 cargs.extend([ 8054 "-type", 8055 self.type_ 8056 ]) 8057 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8060@dataclasses.dataclass 8061class C3dVerbose: 8062 """ 8063 -verbose: Enable verbose output of commands 8064 8065 Syntax: `-verbose` 8066 8067 Commands entered after the **-verbose** command will print debugging 8068 information. This can be turned off with **-noverbose**. 8069 8070 ### Parameter Specifications. 8071 """ 8072 verbose: str 8073 """-verbose: Enable verbose output of commands 8074 8075 Syntax: `-verbose` 8076 8077 Commands entered after the **-verbose** command will print debugging 8078 information. This can be turned off with **-noverbose**. 8079 8080 ### Parameter Specifications""" 8081 8082 def run( 8083 self, 8084 execution: Execution, 8085 ) -> list[str]: 8086 """ 8087 Build command line arguments. This method is called by the main command. 8088 8089 Args: 8090 execution: The execution object. 8091 Returns: 8092 Command line arguments 8093 """ 8094 cargs = [] 8095 cargs.extend([ 8096 "-verbose", 8097 self.verbose 8098 ]) 8099 return cargs
-verbose: Enable verbose output of commands
Syntax: -verbose
Commands entered after the -verbose command will print debugging information. This can be turned off with -noverbose.
Parameter Specifications.
-verbose: Enable verbose output of commands
Syntax: -verbose
Commands entered after the -verbose command will print debugging information. This can be turned off with -noverbose.
Parameter Specifications
8082 def run( 8083 self, 8084 execution: Execution, 8085 ) -> list[str]: 8086 """ 8087 Build command line arguments. This method is called by the main command. 8088 8089 Args: 8090 execution: The execution object. 8091 Returns: 8092 Command line arguments 8093 """ 8094 cargs = [] 8095 cargs.extend([ 8096 "-verbose", 8097 self.verbose 8098 ]) 8099 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8130@dataclasses.dataclass 8131class C3dVersion: 8132 """ 8133 No description found. 8134 """ 8135 version: str 8136 """No description found.""" 8137 8138 def run( 8139 self, 8140 execution: Execution, 8141 ) -> list[str]: 8142 """ 8143 Build command line arguments. This method is called by the main command. 8144 8145 Args: 8146 execution: The execution object. 8147 Returns: 8148 Command line arguments 8149 """ 8150 cargs = [] 8151 cargs.extend([ 8152 "-version", 8153 self.version 8154 ]) 8155 return cargs
No description found.
8138 def run( 8139 self, 8140 execution: Execution, 8141 ) -> list[str]: 8142 """ 8143 Build command line arguments. This method is called by the main command. 8144 8145 Args: 8146 execution: The execution object. 8147 Returns: 8148 Command line arguments 8149 """ 8150 cargs = [] 8151 cargs.extend([ 8152 "-version", 8153 self.version 8154 ]) 8155 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8158@dataclasses.dataclass 8159class C3dVote: 8160 """ 8161 -vote: Vote among images on the stack 8162 8163 Syntax: `-vote ` 8164 8165 This command takes all images on the stack as arguments and at each voxel 8166 *(i,j,k)* returns the index of the image for which the image value at 8167 *(i,j,k)* is the greatest. This is most useful when combining probability 8168 maps into a single label image. If images prob1.img, prob2.img, etc. give 8169 the probability of label 1, 2, etc. over the image domain, the **-vote** 8170 command will return the most probable label at each voxel. 8171 8172 c3d prob1.img prob2.img prob3.img -vote -type uchar -o label.img 8173 8174 The value assigned to each image is based on its position from the bottom of 8175 the stack, with zero indicating bottom-most image. In the example above, the 8176 output image has values 0 for voxels where prob1.img is highest, 1 for 8177 prob2.img and 2 for prob3.img. Also see the related commands **-split** and 8178 **-merge**. 8179 """ 8180 vote: str 8181 """-vote: Vote among images on the stack 8182 8183 Syntax: `-vote ` 8184 8185 This command takes all images on the stack as arguments and at each voxel 8186 *(i,j,k)* returns the index of the image for which the image value at 8187 *(i,j,k)* is the greatest. This is most useful when combining probability 8188 maps into a single label image. If images prob1.img, prob2.img, etc. give 8189 the probability of label 1, 2, etc. over the image domain, the **-vote** 8190 command will return the most probable label at each voxel. 8191 8192 c3d prob1.img prob2.img prob3.img -vote -type uchar -o label.img 8193 8194 The value assigned to each image is based on its position from the bottom of 8195 the stack, with zero indicating bottom-most image. In the example above, the 8196 output image has values 0 for voxels where prob1.img is highest, 1 for 8197 prob2.img and 2 for prob3.img. Also see the related commands **-split** and 8198 **-merge**.""" 8199 8200 def run( 8201 self, 8202 execution: Execution, 8203 ) -> list[str]: 8204 """ 8205 Build command line arguments. This method is called by the main command. 8206 8207 Args: 8208 execution: The execution object. 8209 Returns: 8210 Command line arguments 8211 """ 8212 cargs = [] 8213 cargs.extend([ 8214 "-vote", 8215 self.vote 8216 ]) 8217 return cargs
-vote: Vote among images on the stack
Syntax: -vote
This command takes all images on the stack as arguments and at each voxel (i,j,k) returns the index of the image for which the image value at (i,j,k) is the greatest. This is most useful when combining probability maps into a single label image. If images prob1.img, prob2.img, etc. give the probability of label 1, 2, etc. over the image domain, the -vote command will return the most probable label at each voxel.
c3d prob1.img prob2.img prob3.img -vote -type uchar -o label.img
The value assigned to each image is based on its position from the bottom of the stack, with zero indicating bottom-most image. In the example above, the output image has values 0 for voxels where prob1.img is highest, 1 for prob2.img and 2 for prob3.img. Also see the related commands -split and -merge.
-vote: Vote among images on the stack
Syntax: -vote
This command takes all images on the stack as arguments and at each voxel (i,j,k) returns the index of the image for which the image value at (i,j,k) is the greatest. This is most useful when combining probability maps into a single label image. If images prob1.img, prob2.img, etc. give the probability of label 1, 2, etc. over the image domain, the -vote command will return the most probable label at each voxel.
c3d prob1.img prob2.img prob3.img -vote -type uchar -o label.img
The value assigned to each image is based on its position from the bottom of the stack, with zero indicating bottom-most image. In the example above, the output image has values 0 for voxels where prob1.img is highest, 1 for prob2.img and 2 for prob3.img. Also see the related commands -split and -merge.
8200 def run( 8201 self, 8202 execution: Execution, 8203 ) -> list[str]: 8204 """ 8205 Build command line arguments. This method is called by the main command. 8206 8207 Args: 8208 execution: The execution object. 8209 Returns: 8210 Command line arguments 8211 """ 8212 cargs = [] 8213 cargs.extend([ 8214 "-vote", 8215 self.vote 8216 ]) 8217 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8384@dataclasses.dataclass 8385class C3dVoteLabel: 8386 """ 8387 No description found. 8388 """ 8389 vote_label: str 8390 """No description found.""" 8391 8392 def run( 8393 self, 8394 execution: Execution, 8395 ) -> list[str]: 8396 """ 8397 Build command line arguments. This method is called by the main command. 8398 8399 Args: 8400 execution: The execution object. 8401 Returns: 8402 Command line arguments 8403 """ 8404 cargs = [] 8405 cargs.extend([ 8406 "-vote-label", 8407 self.vote_label 8408 ]) 8409 return cargs
No description found.
8392 def run( 8393 self, 8394 execution: Execution, 8395 ) -> list[str]: 8396 """ 8397 Build command line arguments. This method is called by the main command. 8398 8399 Args: 8400 execution: The execution object. 8401 Returns: 8402 Command line arguments 8403 """ 8404 cargs = [] 8405 cargs.extend([ 8406 "-vote-label", 8407 self.vote_label 8408 ]) 8409 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8220@dataclasses.dataclass 8221class C3dVoteMrf: 8222 """ 8223 -vote-mrf: Vote with Markov Random Field regularlization 8224 8225 Syntax: `-vote-mrf <mode> <lambda>` 8226 8227 This command is similar to **-vote** but it performs regularlization using 8228 the Markov Random Field (MRF). This form of regularization penalizes the 8229 total surface area of the segments in the output. It results in more 8230 contiguous segments. 8231 8232 The command takes all the images on the stack and assumes that they are 8233 likelihood images corresponding to labels 1, 2, ... N. This means that voxel 8234 **x** in image **k** holds the probability that voxel **x** has label **k**. 8235 Likelihood images must be between 0 and 1. Any values outside of the range 8236 are interpreted as the voxel being excluded from the voting. These voxels 8237 will be assigned label 0 in the output. 8238 8239 The problem is encoded in the form of energy minimization, consisting of a 8240 data term and a regularization term. The data term encodes the cost 8241 (penalty) associated with assigning the voxel **x** the label **k**. The 8242 parameter **mode** describes how likelihood images are mapped to the cost. 8243 8244 * `VOTES_AGAINST` or `VA`. This mode is useful when the command is being 8245 used to combine several multi-label segmentations into a single one. Each 8246 likelihood image is assumed to be the proportion of segmentations that 8247 assign label *k* to voxel *x*. The data term equals to the error associated 8248 to assining the voxel *k* label *x*. This error is calculated as the sum of 8249 the likelihoods for all labels at *x* minus the likelihood for *k* at *x*. 8250 Note that the likelihoods do not have to add up to one, which may be 8251 interpreted as missing data for some voxels. 8252 8253 * `LOG_LIKELIHOOD` or `LL`. The cost for label *k* at voxel *x* is the 8254 logarithm of the k-th likelihood image at *x*. This will assign infinite 8255 cost when the likelihood is zero. 8256 8257 The regularlization term is encoded as **lambda** times the total number of 8258 neighboring voxels inside the mask (non-excluded region of the image) that 8259 have different labels. 8260 8261 The optmization problem is solved using the Alpha-Expansion graph cut 8262 algorithm. Users of this functionality should cite the following papers. 8263 8264 1. Yuri Boykov, Olga Veksler, Ramin Zabih, *Efficient Approximate Energy 8265 Minimization via Graph Cuts*, IEEE transactions on PAMI, vol. 20, no. 12, p. 8266 1222-1239, 2001. 8267 8268 2. Vladimir Kolmogorov and Ramin Zabih, *What Energy Functions can be 8269 Minimized via Graph Cuts?*, IEEE transactions on PAMI, vol. 26, no. 2, p. 8270 147-159, 2004. 8271 8272 3. Yuri Boykov and Vladimir Kolmogorov, *An Experimental Comparison of 8273 Min-Cut/Max-Flow Algorithms for Energy Minimization in Vision*, IEEE 8274 transactions on PAMI, vol. 26, no. 9, p. 1124-1137, 2004. 8275 8276 As noted in the open source implementation of the graph cuts algorithms 8277 distributed under the General Public License, "This software can be used 8278 only for research purposes, you should cite the aforementioned paper in any 8279 resulting publication. If you wish to use this software (or the algorithms 8280 described in the aforementioned paper) for commercial purposes, you should 8281 be aware that there is a US patent: R. Zabih, Y. Boykov, O. Veksler, *System 8282 and method for fast approximate energy minimization via graph cuts*, United 8283 Stated Patent 6,744,923, June 1, 2004. 8284 8285 The example below illustrates applying **-vote-mrf** with a user-specified 8286 mask. Voxels outside of the mask are first remapped to NaN (not a number) 8287 and thus excluded from the MRF optimization and given 0 label. 8288 8289 c3d lhood01.nii lhood02.nii lhood03.nii mask.nii -popas M \ 8290 -foreach -push M -replace 0 NaN -times -endfor \ 8291 -vote-mrf VA 0.2 -o result.nii. 8292 """ 8293 vote_mrf: str 8294 """-vote-mrf: Vote with Markov Random Field regularlization 8295 8296 Syntax: `-vote-mrf <mode> <lambda>` 8297 8298 This command is similar to **-vote** but it performs regularlization using 8299 the Markov Random Field (MRF). This form of regularization penalizes the 8300 total surface area of the segments in the output. It results in more 8301 contiguous segments. 8302 8303 The command takes all the images on the stack and assumes that they are 8304 likelihood images corresponding to labels 1, 2, ... N. This means that voxel 8305 **x** in image **k** holds the probability that voxel **x** has label **k**. 8306 Likelihood images must be between 0 and 1. Any values outside of the range 8307 are interpreted as the voxel being excluded from the voting. These voxels 8308 will be assigned label 0 in the output. 8309 8310 The problem is encoded in the form of energy minimization, consisting of a 8311 data term and a regularization term. The data term encodes the cost 8312 (penalty) associated with assigning the voxel **x** the label **k**. The 8313 parameter **mode** describes how likelihood images are mapped to the cost. 8314 8315 * `VOTES_AGAINST` or `VA`. This mode is useful when the command is being 8316 used to combine several multi-label segmentations into a single one. Each 8317 likelihood image is assumed to be the proportion of segmentations that 8318 assign label *k* to voxel *x*. The data term equals to the error associated 8319 to assining the voxel *k* label *x*. This error is calculated as the sum of 8320 the likelihoods for all labels at *x* minus the likelihood for *k* at *x*. 8321 Note that the likelihoods do not have to add up to one, which may be 8322 interpreted as missing data for some voxels. 8323 8324 * `LOG_LIKELIHOOD` or `LL`. The cost for label *k* at voxel *x* is the 8325 logarithm of the k-th likelihood image at *x*. This will assign infinite 8326 cost when the likelihood is zero. 8327 8328 The regularlization term is encoded as **lambda** times the total number of 8329 neighboring voxels inside the mask (non-excluded region of the image) that 8330 have different labels. 8331 8332 The optmization problem is solved using the Alpha-Expansion graph cut 8333 algorithm. Users of this functionality should cite the following papers. 8334 8335 1. Yuri Boykov, Olga Veksler, Ramin Zabih, *Efficient Approximate Energy 8336 Minimization via Graph Cuts*, IEEE transactions on PAMI, vol. 20, no. 12, p. 8337 1222-1239, 2001. 8338 8339 2. Vladimir Kolmogorov and Ramin Zabih, *What Energy Functions can be 8340 Minimized via Graph Cuts?*, IEEE transactions on PAMI, vol. 26, no. 2, p. 8341 147-159, 2004. 8342 8343 3. Yuri Boykov and Vladimir Kolmogorov, *An Experimental Comparison of 8344 Min-Cut/Max-Flow Algorithms for Energy Minimization in Vision*, IEEE 8345 transactions on PAMI, vol. 26, no. 9, p. 1124-1137, 2004. 8346 8347 As noted in the open source implementation of the graph cuts algorithms 8348 distributed under the General Public License, "This software can be used 8349 only for research purposes, you should cite the aforementioned paper in any 8350 resulting publication. If you wish to use this software (or the algorithms 8351 described in the aforementioned paper) for commercial purposes, you should 8352 be aware that there is a US patent: R. Zabih, Y. Boykov, O. Veksler, *System 8353 and method for fast approximate energy minimization via graph cuts*, United 8354 Stated Patent 6,744,923, June 1, 2004. 8355 8356 The example below illustrates applying **-vote-mrf** with a user-specified 8357 mask. Voxels outside of the mask are first remapped to NaN (not a number) 8358 and thus excluded from the MRF optimization and given 0 label. 8359 8360 c3d lhood01.nii lhood02.nii lhood03.nii mask.nii -popas M \ 8361 -foreach -push M -replace 0 NaN -times -endfor \ 8362 -vote-mrf VA 0.2 -o result.nii""" 8363 8364 def run( 8365 self, 8366 execution: Execution, 8367 ) -> list[str]: 8368 """ 8369 Build command line arguments. This method is called by the main command. 8370 8371 Args: 8372 execution: The execution object. 8373 Returns: 8374 Command line arguments 8375 """ 8376 cargs = [] 8377 cargs.extend([ 8378 "-vote-mrf", 8379 self.vote_mrf 8380 ]) 8381 return cargs
-vote-mrf: Vote with Markov Random Field regularlization
Syntax: -vote-mrf <mode> <lambda>
This command is similar to -vote but it performs regularlization using the Markov Random Field (MRF). This form of regularization penalizes the total surface area of the segments in the output. It results in more contiguous segments.
The command takes all the images on the stack and assumes that they are likelihood images corresponding to labels 1, 2, ... N. This means that voxel x in image k holds the probability that voxel x has label k. Likelihood images must be between 0 and 1. Any values outside of the range are interpreted as the voxel being excluded from the voting. These voxels will be assigned label 0 in the output.
The problem is encoded in the form of energy minimization, consisting of a data term and a regularization term. The data term encodes the cost (penalty) associated with assigning the voxel x the label k. The parameter mode describes how likelihood images are mapped to the cost.
VOTES_AGAINSTorVA. This mode is useful when the command is being used to combine several multi-label segmentations into a single one. Each likelihood image is assumed to be the proportion of segmentations that assign label k to voxel x. The data term equals to the error associated to assining the voxel k label x. This error is calculated as the sum of the likelihoods for all labels at x minus the likelihood for k at x. Note that the likelihoods do not have to add up to one, which may be interpreted as missing data for some voxels.LOG_LIKELIHOODorLL. The cost for label k at voxel x is the logarithm of the k-th likelihood image at x. This will assign infinite cost when the likelihood is zero.
The regularlization term is encoded as lambda times the total number of neighboring voxels inside the mask (non-excluded region of the image) that have different labels.
The optmization problem is solved using the Alpha-Expansion graph cut algorithm. Users of this functionality should cite the following papers.
Yuri Boykov, Olga Veksler, Ramin Zabih, Efficient Approximate Energy Minimization via Graph Cuts, IEEE transactions on PAMI, vol. 20, no. 12, p. 1222-1239, 2001.
Vladimir Kolmogorov and Ramin Zabih, What Energy Functions can be Minimized via Graph Cuts?, IEEE transactions on PAMI, vol. 26, no. 2, p. 147-159, 2004.
Yuri Boykov and Vladimir Kolmogorov, An Experimental Comparison of Min-Cut/Max-Flow Algorithms for Energy Minimization in Vision, IEEE transactions on PAMI, vol. 26, no. 9, p. 1124-1137, 2004.
As noted in the open source implementation of the graph cuts algorithms distributed under the General Public License, "This software can be used only for research purposes, you should cite the aforementioned paper in any resulting publication. If you wish to use this software (or the algorithms described in the aforementioned paper) for commercial purposes, you should be aware that there is a US patent: R. Zabih, Y. Boykov, O. Veksler, System and method for fast approximate energy minimization via graph cuts, United Stated Patent 6,744,923, June 1, 2004.
The example below illustrates applying -vote-mrf with a user-specified mask. Voxels outside of the mask are first remapped to NaN (not a number) and thus excluded from the MRF optimization and given 0 label.
c3d lhood01.nii lhood02.nii lhood03.nii mask.nii -popas M -foreach -push M -replace 0 NaN -times -endfor -vote-mrf VA 0.2 -o result.nii.
-vote-mrf: Vote with Markov Random Field regularlization
Syntax: -vote-mrf <mode> <lambda>
This command is similar to -vote but it performs regularlization using the Markov Random Field (MRF). This form of regularization penalizes the total surface area of the segments in the output. It results in more contiguous segments.
The command takes all the images on the stack and assumes that they are likelihood images corresponding to labels 1, 2, ... N. This means that voxel x in image k holds the probability that voxel x has label k. Likelihood images must be between 0 and 1. Any values outside of the range are interpreted as the voxel being excluded from the voting. These voxels will be assigned label 0 in the output.
The problem is encoded in the form of energy minimization, consisting of a data term and a regularization term. The data term encodes the cost (penalty) associated with assigning the voxel x the label k. The parameter mode describes how likelihood images are mapped to the cost.
VOTES_AGAINSTorVA. This mode is useful when the command is being used to combine several multi-label segmentations into a single one. Each likelihood image is assumed to be the proportion of segmentations that assign label k to voxel x. The data term equals to the error associated to assining the voxel k label x. This error is calculated as the sum of the likelihoods for all labels at x minus the likelihood for k at x. Note that the likelihoods do not have to add up to one, which may be interpreted as missing data for some voxels.LOG_LIKELIHOODorLL. The cost for label k at voxel x is the logarithm of the k-th likelihood image at x. This will assign infinite cost when the likelihood is zero.
The regularlization term is encoded as lambda times the total number of neighboring voxels inside the mask (non-excluded region of the image) that have different labels.
The optmization problem is solved using the Alpha-Expansion graph cut algorithm. Users of this functionality should cite the following papers.
Yuri Boykov, Olga Veksler, Ramin Zabih, Efficient Approximate Energy Minimization via Graph Cuts, IEEE transactions on PAMI, vol. 20, no. 12, p. 1222-1239, 2001.
Vladimir Kolmogorov and Ramin Zabih, What Energy Functions can be Minimized via Graph Cuts?, IEEE transactions on PAMI, vol. 26, no. 2, p. 147-159, 2004.
Yuri Boykov and Vladimir Kolmogorov, An Experimental Comparison of Min-Cut/Max-Flow Algorithms for Energy Minimization in Vision, IEEE transactions on PAMI, vol. 26, no. 9, p. 1124-1137, 2004.
As noted in the open source implementation of the graph cuts algorithms distributed under the General Public License, "This software can be used only for research purposes, you should cite the aforementioned paper in any resulting publication. If you wish to use this software (or the algorithms described in the aforementioned paper) for commercial purposes, you should be aware that there is a US patent: R. Zabih, Y. Boykov, O. Veksler, System and method for fast approximate energy minimization via graph cuts, United Stated Patent 6,744,923, June 1, 2004.
The example below illustrates applying -vote-mrf with a user-specified mask. Voxels outside of the mask are first remapped to NaN (not a number) and thus excluded from the MRF optimization and given 0 label.
c3d lhood01.nii lhood02.nii lhood03.nii mask.nii -popas M -foreach -push M -replace 0 NaN -times -endfor -vote-mrf VA 0.2 -o result.nii
8364 def run( 8365 self, 8366 execution: Execution, 8367 ) -> list[str]: 8368 """ 8369 Build command line arguments. This method is called by the main command. 8370 8371 Args: 8372 execution: The execution object. 8373 Returns: 8374 Command line arguments 8375 """ 8376 cargs = [] 8377 cargs.extend([ 8378 "-vote-mrf", 8379 self.vote_mrf 8380 ]) 8381 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8454@dataclasses.dataclass 8455class C3dVoxelIntegral: 8456 """ 8457 -voxel-integral: Print volume integral of all voxel intensities 8458 8459 Syntax: `-voxel-integral` 8460 8461 Like **-voxel-sum**, but multiplies the sum of voxel intensities by voxel 8462 volume. This is useful for computing volumes of objects represented by 8463 binary images. The result is in 'ml'. 8464 8465 $ c3d image.img -voxel-integral 8466 Voxel Integral: 2341. 8467 """ 8468 voxel_integral: str 8469 """-voxel-integral: Print volume integral of all voxel intensities 8470 8471 Syntax: `-voxel-integral` 8472 8473 Like **-voxel-sum**, but multiplies the sum of voxel intensities by voxel 8474 volume. This is useful for computing volumes of objects represented by 8475 binary images. The result is in 'ml'. 8476 8477 $ c3d image.img -voxel-integral 8478 Voxel Integral: 2341""" 8479 8480 def run( 8481 self, 8482 execution: Execution, 8483 ) -> list[str]: 8484 """ 8485 Build command line arguments. This method is called by the main command. 8486 8487 Args: 8488 execution: The execution object. 8489 Returns: 8490 Command line arguments 8491 """ 8492 cargs = [] 8493 cargs.extend([ 8494 "-voxel-integral", 8495 self.voxel_integral 8496 ]) 8497 return cargs
-voxel-integral: Print volume integral of all voxel intensities
Syntax: -voxel-integral
Like -voxel-sum, but multiplies the sum of voxel intensities by voxel volume. This is useful for computing volumes of objects represented by binary images. The result is in 'ml'.
$ c3d image.img -voxel-integral Voxel Integral: 2341.
-voxel-integral: Print volume integral of all voxel intensities
Syntax: -voxel-integral
Like -voxel-sum, but multiplies the sum of voxel intensities by voxel volume. This is useful for computing volumes of objects represented by binary images. The result is in 'ml'.
$ c3d image.img -voxel-integral Voxel Integral: 2341
8480 def run( 8481 self, 8482 execution: Execution, 8483 ) -> list[str]: 8484 """ 8485 Build command line arguments. This method is called by the main command. 8486 8487 Args: 8488 execution: The execution object. 8489 Returns: 8490 Command line arguments 8491 """ 8492 cargs = [] 8493 cargs.extend([ 8494 "-voxel-integral", 8495 self.voxel_integral 8496 ]) 8497 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8412@dataclasses.dataclass 8413class C3dVoxelSum: 8414 """ 8415 -voxel-sum: Print sum of all voxel intensities 8416 8417 Syntax: `-voxel-sum ` 8418 8419 Print the sum of all voxels in the image. 8420 8421 $ c3d image.img -voxel-sum 8422 Voxel Sum: 200923123. 8423 """ 8424 voxel_sum: str 8425 """-voxel-sum: Print sum of all voxel intensities 8426 8427 Syntax: `-voxel-sum ` 8428 8429 Print the sum of all voxels in the image. 8430 8431 $ c3d image.img -voxel-sum 8432 Voxel Sum: 200923123""" 8433 8434 def run( 8435 self, 8436 execution: Execution, 8437 ) -> list[str]: 8438 """ 8439 Build command line arguments. This method is called by the main command. 8440 8441 Args: 8442 execution: The execution object. 8443 Returns: 8444 Command line arguments 8445 """ 8446 cargs = [] 8447 cargs.extend([ 8448 "-voxel-sum", 8449 self.voxel_sum 8450 ]) 8451 return cargs
-voxel-sum: Print sum of all voxel intensities
Syntax: -voxel-sum
Print the sum of all voxels in the image.
$ c3d image.img -voxel-sum Voxel Sum: 200923123.
-voxel-sum: Print sum of all voxel intensities
Syntax: -voxel-sum
Print the sum of all voxels in the image.
$ c3d image.img -voxel-sum Voxel Sum: 200923123
8434 def run( 8435 self, 8436 execution: Execution, 8437 ) -> list[str]: 8438 """ 8439 Build command line arguments. This method is called by the main command. 8440 8441 Args: 8442 execution: The execution object. 8443 Returns: 8444 Command line arguments 8445 """ 8446 cargs = [] 8447 cargs.extend([ 8448 "-voxel-sum", 8449 self.voxel_sum 8450 ]) 8451 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8500@dataclasses.dataclass 8501class C3dVoxelwiseRegression: 8502 """ 8503 -voxreg, -voxelwise-regression: Regression between two images 8504 8505 Syntax: `-voxreg regression_order ` 8506 8507 Perform regression between corresponding voxels in two images. This command 8508 takes two images as input, X and Y. This command finds parameters b\_0, 8509 b\_1, ..., b\_k, such that Y is best approximated by b\_0 + b\_1 * X + b\_2 8510 * X^2 + ... + b_k * X^k. Here is an example of linear regression. 8511 8512 $ c3d Y.nii X.nii -voxreg 2 8513 REGCOEFF[0] = 5.56935 8514 REGCOEFF[1] = 0.844024 8515 8516 $ c3d Y.nii X.nii -scale 0.844024 -shift 5.56935 -voxreg 2 8517 REGCOEFF[0] = 0 8518 REGCOEFF[1] = 1. 8519 """ 8520 voxelwise_regression: str 8521 """-voxreg, -voxelwise-regression: Regression between two images 8522 8523 Syntax: `-voxreg regression_order ` 8524 8525 Perform regression between corresponding voxels in two images. This command 8526 takes two images as input, X and Y. This command finds parameters b\_0, 8527 b\_1, ..., b\_k, such that Y is best approximated by b\_0 + b\_1 * X + b\_2 8528 * X^2 + ... + b_k * X^k. Here is an example of linear regression. 8529 8530 $ c3d Y.nii X.nii -voxreg 2 8531 REGCOEFF[0] = 5.56935 8532 REGCOEFF[1] = 0.844024 8533 8534 $ c3d Y.nii X.nii -scale 0.844024 -shift 5.56935 -voxreg 2 8535 REGCOEFF[0] = 0 8536 REGCOEFF[1] = 1""" 8537 8538 def run( 8539 self, 8540 execution: Execution, 8541 ) -> list[str]: 8542 """ 8543 Build command line arguments. This method is called by the main command. 8544 8545 Args: 8546 execution: The execution object. 8547 Returns: 8548 Command line arguments 8549 """ 8550 cargs = [] 8551 cargs.extend([ 8552 "-voxelwise-regression", 8553 self.voxelwise_regression 8554 ]) 8555 return cargs
-voxreg, -voxelwise-regression: Regression between two images
Syntax: -voxreg regression_order
Perform regression between corresponding voxels in two images. This command takes two images as input, X and Y. This command finds parameters b_0, b_1, ..., b_k, such that Y is best approximated by b_0 + b_1 * X + b_2
- X^2 + ... + b_k * X^k. Here is an example of linear regression.
$ c3d Y.nii X.nii -voxreg 2 REGCOEFF[0] = 5.56935 REGCOEFF[1] = 0.844024
$ c3d Y.nii X.nii -scale 0.844024 -shift 5.56935 -voxreg 2 REGCOEFF[0] = 0 REGCOEFF[1] = 1.
-voxreg, -voxelwise-regression: Regression between two images
Syntax: -voxreg regression_order
Perform regression between corresponding voxels in two images. This command takes two images as input, X and Y. This command finds parameters b_0, b_1, ..., b_k, such that Y is best approximated by b_0 + b_1 * X + b_2
- X^2 + ... + b_k * X^k. Here is an example of linear regression.
$ c3d Y.nii X.nii -voxreg 2 REGCOEFF[0] = 5.56935 REGCOEFF[1] = 0.844024
$ c3d Y.nii X.nii -scale 0.844024 -shift 5.56935 -voxreg 2 REGCOEFF[0] = 0 REGCOEFF[1] = 1
8538 def run( 8539 self, 8540 execution: Execution, 8541 ) -> list[str]: 8542 """ 8543 Build command line arguments. This method is called by the main command. 8544 8545 Args: 8546 execution: The execution object. 8547 Returns: 8548 Command line arguments 8549 """ 8550 cargs = [] 8551 cargs.extend([ 8552 "-voxelwise-regression", 8553 self.voxelwise_regression 8554 ]) 8555 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8558@dataclasses.dataclass 8559class C3dWarp: 8560 """ 8561 No description found. 8562 """ 8563 warp: str 8564 """No description found.""" 8565 8566 def run( 8567 self, 8568 execution: Execution, 8569 ) -> list[str]: 8570 """ 8571 Build command line arguments. This method is called by the main command. 8572 8573 Args: 8574 execution: The execution object. 8575 Returns: 8576 Command line arguments 8577 """ 8578 cargs = [] 8579 cargs.extend([ 8580 "-warp", 8581 self.warp 8582 ]) 8583 return cargs
No description found.
8566 def run( 8567 self, 8568 execution: Execution, 8569 ) -> list[str]: 8570 """ 8571 Build command line arguments. This method is called by the main command. 8572 8573 Args: 8574 execution: The execution object. 8575 Returns: 8576 Command line arguments 8577 """ 8578 cargs = [] 8579 cargs.extend([ 8580 "-warp", 8581 self.warp 8582 ]) 8583 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8586@dataclasses.dataclass 8587class C3dWarpLabel: 8588 """ 8589 No description found. 8590 """ 8591 warp_label: str 8592 """No description found.""" 8593 8594 def run( 8595 self, 8596 execution: Execution, 8597 ) -> list[str]: 8598 """ 8599 Build command line arguments. This method is called by the main command. 8600 8601 Args: 8602 execution: The execution object. 8603 Returns: 8604 Command line arguments 8605 """ 8606 cargs = [] 8607 cargs.extend([ 8608 "-warp-label", 8609 self.warp_label 8610 ]) 8611 return cargs
No description found.
8594 def run( 8595 self, 8596 execution: Execution, 8597 ) -> list[str]: 8598 """ 8599 Build command line arguments. This method is called by the main command. 8600 8601 Args: 8602 execution: The execution object. 8603 Returns: 8604 Command line arguments 8605 """ 8606 cargs = [] 8607 cargs.extend([ 8608 "-warp-label", 8609 self.warp_label 8610 ]) 8611 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8678@dataclasses.dataclass 8679class C3dWeightedSum: 8680 """ 8681 -wsum, -weighted-sum: Weighed sum of images with constant weights 8682 8683 Syntax: `-wsum weight1 weight2 ... weightN ` 8684 8685 Computes weighted sum of the last N images on the stack. 8686 8687 c3d image1.nii image2.nii image3.nii -wsum 0.2 0.7 0.1 -o wsum.nii 8688 8689 This command is particularly useful for combining components in a 8690 multicomponent image. For example, for an RGB image, we can convert it to 8691 grayscale (using [ImageMagick][13] formula) as follows: 8692 8693 c3d -mcs rgb.nii -wsum 0.29900 0.58700 0.11400 -o gray.nii. 8694 """ 8695 weighted_sum: str 8696 """-wsum, -weighted-sum: Weighed sum of images with constant weights 8697 8698 Syntax: `-wsum weight1 weight2 ... weightN ` 8699 8700 Computes weighted sum of the last N images on the stack. 8701 8702 c3d image1.nii image2.nii image3.nii -wsum 0.2 0.7 0.1 -o wsum.nii 8703 8704 This command is particularly useful for combining components in a 8705 multicomponent image. For example, for an RGB image, we can convert it to 8706 grayscale (using [ImageMagick][13] formula) as follows: 8707 8708 c3d -mcs rgb.nii -wsum 0.29900 0.58700 0.11400 -o gray.nii""" 8709 8710 def run( 8711 self, 8712 execution: Execution, 8713 ) -> list[str]: 8714 """ 8715 Build command line arguments. This method is called by the main command. 8716 8717 Args: 8718 execution: The execution object. 8719 Returns: 8720 Command line arguments 8721 """ 8722 cargs = [] 8723 cargs.extend([ 8724 "-weighted-sum", 8725 self.weighted_sum 8726 ]) 8727 return cargs
-wsum, -weighted-sum: Weighed sum of images with constant weights
Syntax: -wsum weight1 weight2 ... weightN
Computes weighted sum of the last N images on the stack.
c3d image1.nii image2.nii image3.nii -wsum 0.2 0.7 0.1 -o wsum.nii
This command is particularly useful for combining components in a multicomponent image. For example, for an RGB image, we can convert it to grayscale (using [ImageMagick][13] formula) as follows:
c3d -mcs rgb.nii -wsum 0.29900 0.58700 0.11400 -o gray.nii.
-wsum, -weighted-sum: Weighed sum of images with constant weights
Syntax: -wsum weight1 weight2 ... weightN
Computes weighted sum of the last N images on the stack.
c3d image1.nii image2.nii image3.nii -wsum 0.2 0.7 0.1 -o wsum.nii
This command is particularly useful for combining components in a multicomponent image. For example, for an RGB image, we can convert it to grayscale (using [ImageMagick][13] formula) as follows:
c3d -mcs rgb.nii -wsum 0.29900 0.58700 0.11400 -o gray.nii
8710 def run( 8711 self, 8712 execution: Execution, 8713 ) -> list[str]: 8714 """ 8715 Build command line arguments. This method is called by the main command. 8716 8717 Args: 8718 execution: The execution object. 8719 Returns: 8720 Command line arguments 8721 """ 8722 cargs = [] 8723 cargs.extend([ 8724 "-weighted-sum", 8725 self.weighted_sum 8726 ]) 8727 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8730@dataclasses.dataclass 8731class C3dWeightedSumVoxelwise: 8732 """ 8733 -wsv, -weighed-sum-voxelwise: Weighed sum of images with spatially varying 8734 weights 8735 8736 Syntax: `-wsv ` 8737 8738 Computes weighted sum of N weight images and N scalar images. The images 8739 must be interleaved on the stack. All images on the stack are used. 8740 8741 c3d weight1.nii image1.nii weight2.nii image2.nii weight3.nii image3.nii 8742 -wsv -o mysum.nii.gz 8743 8744 The **-reorder** command can simplify loading the images: 8745 8746 c3d weight*.nii image*.nii -reorder 0.5 -wsv -o mysum.nii.gz 8747 8748 ### Commands: Image Header Manipulation. 8749 """ 8750 weighted_sum_voxelwise: str 8751 """-wsv, -weighed-sum-voxelwise: Weighed sum of images with spatially 8752 varying weights 8753 8754 Syntax: `-wsv ` 8755 8756 Computes weighted sum of N weight images and N scalar images. The images 8757 must be interleaved on the stack. All images on the stack are used. 8758 8759 c3d weight1.nii image1.nii weight2.nii image2.nii weight3.nii image3.nii 8760 -wsv -o mysum.nii.gz 8761 8762 The **-reorder** command can simplify loading the images: 8763 8764 c3d weight*.nii image*.nii -reorder 0.5 -wsv -o mysum.nii.gz 8765 8766 ### Commands: Image Header Manipulation""" 8767 8768 def run( 8769 self, 8770 execution: Execution, 8771 ) -> list[str]: 8772 """ 8773 Build command line arguments. This method is called by the main command. 8774 8775 Args: 8776 execution: The execution object. 8777 Returns: 8778 Command line arguments 8779 """ 8780 cargs = [] 8781 cargs.extend([ 8782 "-weighted-sum-voxelwise", 8783 self.weighted_sum_voxelwise 8784 ]) 8785 return cargs
-wsv, -weighed-sum-voxelwise: Weighed sum of images with spatially varying weights
Syntax: -wsv
Computes weighted sum of N weight images and N scalar images. The images must be interleaved on the stack. All images on the stack are used.
c3d weight1.nii image1.nii weight2.nii image2.nii weight3.nii image3.nii -wsv -o mysum.nii.gz
The -reorder command can simplify loading the images:
c3d weight.nii image.nii -reorder 0.5 -wsv -o mysum.nii.gz
Commands: Image Header Manipulation.
-wsv, -weighed-sum-voxelwise: Weighed sum of images with spatially varying weights
Syntax: -wsv
Computes weighted sum of N weight images and N scalar images. The images must be interleaved on the stack. All images on the stack are used.
c3d weight1.nii image1.nii weight2.nii image2.nii weight3.nii image3.nii -wsv -o mysum.nii.gz
The -reorder command can simplify loading the images:
c3d weight.nii image.nii -reorder 0.5 -wsv -o mysum.nii.gz
Commands: Image Header Manipulation
8768 def run( 8769 self, 8770 execution: Execution, 8771 ) -> list[str]: 8772 """ 8773 Build command line arguments. This method is called by the main command. 8774 8775 Args: 8776 execution: The execution object. 8777 Returns: 8778 Command line arguments 8779 """ 8780 cargs = [] 8781 cargs.extend([ 8782 "-weighted-sum-voxelwise", 8783 self.weighted_sum_voxelwise 8784 ]) 8785 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8614@dataclasses.dataclass 8615class C3dWrap: 8616 """ 8617 -wrap: Wrap (rotate) image 8618 8619 Syntax: `-wrap <vector> ` 8620 8621 Wrap image around one or more voxel dimensions. Wrapping is typically used 8622 to correct for MRI wrap-around artifacts. The vector must have integer 8623 components, possibly negative. For example, 8624 8625 c3d badmri.nii.gz -wrap 0x20x0 -o fixedmri.nii.gz 8626 8627 will wrap the image in the second voxel dimension by 20 voxels (i.e., voxel 8628 at 10x40x20 will me moved to the position 10x20x20). 8629 8630 8631 ### Commands: Options and Parameters 8632 8633 Options change the behavior of commands that *appear later on the command 8634 line*. This is very important. Specifying options after the command will 8635 have no effect. 8636 """ 8637 wrap: str 8638 """-wrap: Wrap (rotate) image 8639 8640 Syntax: `-wrap <vector> ` 8641 8642 Wrap image around one or more voxel dimensions. Wrapping is typically used 8643 to correct for MRI wrap-around artifacts. The vector must have integer 8644 components, possibly negative. For example, 8645 8646 c3d badmri.nii.gz -wrap 0x20x0 -o fixedmri.nii.gz 8647 8648 will wrap the image in the second voxel dimension by 20 voxels (i.e., voxel 8649 at 10x40x20 will me moved to the position 10x20x20). 8650 8651 8652 ### Commands: Options and Parameters 8653 8654 Options change the behavior of commands that *appear later on the command 8655 line*. This is very important. Specifying options after the command will 8656 have no effect.""" 8657 8658 def run( 8659 self, 8660 execution: Execution, 8661 ) -> list[str]: 8662 """ 8663 Build command line arguments. This method is called by the main command. 8664 8665 Args: 8666 execution: The execution object. 8667 Returns: 8668 Command line arguments 8669 """ 8670 cargs = [] 8671 cargs.extend([ 8672 "-wrap", 8673 self.wrap 8674 ]) 8675 return cargs
-wrap: Wrap (rotate) image
Syntax: -wrap <vector>
Wrap image around one or more voxel dimensions. Wrapping is typically used to correct for MRI wrap-around artifacts. The vector must have integer components, possibly negative. For example,
c3d badmri.nii.gz -wrap 0x20x0 -o fixedmri.nii.gz
will wrap the image in the second voxel dimension by 20 voxels (i.e., voxel at 10x40x20 will me moved to the position 10x20x20).
Commands: Options and Parameters
Options change the behavior of commands that appear later on the command line. This is very important. Specifying options after the command will have no effect.
-wrap: Wrap (rotate) image
Syntax: -wrap <vector>
Wrap image around one or more voxel dimensions. Wrapping is typically used to correct for MRI wrap-around artifacts. The vector must have integer components, possibly negative. For example,
c3d badmri.nii.gz -wrap 0x20x0 -o fixedmri.nii.gz
will wrap the image in the second voxel dimension by 20 voxels (i.e., voxel at 10x40x20 will me moved to the position 10x20x20).
Commands: Options and Parameters
Options change the behavior of commands that appear later on the command line. This is very important. Specifying options after the command will have no effect.
8658 def run( 8659 self, 8660 execution: Execution, 8661 ) -> list[str]: 8662 """ 8663 Build command line arguments. This method is called by the main command. 8664 8665 Args: 8666 execution: The execution object. 8667 Returns: 8668 Command line arguments 8669 """ 8670 cargs = [] 8671 cargs.extend([ 8672 "-wrap", 8673 self.wrap 8674 ]) 8675 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8799def c3d_( 8800 input_: list[InputPathType], 8801 operations: list[typing.Union[C3dAccum, C3dAcos, C3dAdd, C3dAlignLandmarks, C3dAnisotropicDiffusion, C3dAntialias, C3dSet, C3dAsin, C3dAtan2, C3dBackground, C3dN4BiasCorrection, C3dBinarize, C3dCanny, C3dCeil, C3dCentroid, C3dCentroidMark, C3dConnectedComponents, C3dClear, C3dClip, C3dColorMap, C3dCompress, C3dNoCompress, C3dConv, C3dCoordinateMapVoxel, C3dCoordinateMapPhysical, C3dCopyTransform, C3dCos, C3dCreate, C3dDicomSeriesList, C3dDicomSeriesRead, C3dDilate, C3dDivide, C3dDuplicate, C3dEndaccum, C3dEndfor, C3dErode, C3dErf, C3dExp, C3dExportPatches, C3dExportPatchesAug, C3dExtrudeSeg, C3dFillBackgroundWithNoise, C3dFft, C3dFlip, C3dFloor, C3dForeach, C3dForeachComp, C3dGlm, C3dGradient, C3dHelp, C3dHolefill, C3dHessianEigenvalues, C3dHessianObjectness, C3dHistogramMatch, C3dInfo, C3dInfoFull, C3dInsert, C3dInterpolation, C3dIterations, C3dLabelOverlap, C3dLabelStatistics, C3dLandmarksToSpheres, C3dLaplacian, C3dLevelset, C3dLevelsetCurvature, C3dLevelsetAdvection, C3dLog, C3dLog10, C3dManual, C3dMatchBoundingBox, C3dMaximum, C3dMulticomponentSplit, C3dMean, C3dMedianFilter, C3dMerge, C3dMeanFilter, C3dMutualInfo, C3dMinimum, C3dMixtureModel, C3dMoments, C3dMattesMutualInfo, C3dMeanSquare, C3dMultiply, C3dNormalizedCrossCorrelation, C3dNormalizedCorrelation, C3dNormalizedMutualInfo, C3dNoiseGaussian, C3dNoisePoisson, C3dNoiseSpeckle, C3dNoiseSaltPepper, C3dNoMulticomponentSplit, C3dNormalizeLocalWindow, C3dNormpdf, C3dNoround, C3dNospm, C3dOutput, C3dOutputMulticomponent, C3dOutputMultipleMulticomponent, C3dOrient, C3dOutputMultiple, C3dOrient_, C3dOrigin, C3dOriginVoxel, C3dOriginVoxelCoord, C3dOverlap, C3dOverlayLabelImage, C3dPad, C3dPadTo, C3dPca, C3dPercentIntensityMode, C3dPixel, C3dPop, C3dPopas, C3dProbe, C3dPush, C3dRank, C3dReciprocal, C3dRegion, C3dReorder, C3dRetainLabels, C3dRfApply, C3dRfTrain, C3dRfParamPatch, C3dRfParamUsexyz, C3dRfParamNousexyz, C3dRfParamNtrees, C3dRfParamTreedepth, C3dSetSform, C3dReplace, C3dResample, C3dResampleIso, C3dResampleMm, C3dResliceItk, C3dResliceMatrix, C3dResliceIdentity, C3dRgb2hsv, C3dRms, C3dRound, C3dScale, C3dSetSform_, C3dSin, C3dSlice, C3dSliceAll, C3dSharpen, C3dShift, C3dSignedDistanceTransform, C3dSmooth, C3dSmoothFast, C3dSpacing, C3dSplit, C3dSqrt, C3dStaple, C3dStructureTensorEigenvalues, C3dSpm, C3dSubtract, C3dSupervoxel, C3dStretch, C3dSwapdim, C3dTestImage, C3dTestProbe, C3dThreshold, C3dTile, C3dTrim, C3dTrimToSize, C3dType, C3dVerbose, C3dNoverbose, C3dVersion, C3dVote, C3dVoteMrf, C3dVoteLabel, C3dVoxelSum, C3dVoxelIntegral, C3dVoxelwiseRegression, C3dWarp, C3dWarpLabel, C3dWrap, C3dWeightedSum, C3dWeightedSumVoxelwise]], 8802 output: str, 8803 runner: Runner | None = None, 8804) -> C3dOutputs: 8805 """ 8806 C3D is a command-line tool for medical image processing. 8807 8808 Author: ITK-Snap Team 8809 8810 Args: 8811 input_: The input image to process. 8812 operations: The operations to perform. 8813 output: The output image. 8814 runner: Command runner. 8815 Returns: 8816 NamedTuple of outputs (described in `C3dOutputs`). 8817 """ 8818 runner = runner or get_global_runner() 8819 execution = runner.start_execution(C3D_METADATA) 8820 cargs = [] 8821 cargs.append("c3d") 8822 cargs.append(" ".join([execution.input_file(f) for f in input_])) 8823 cargs.extend([a for c in [s.run(execution) for s in operations] for a in c]) 8824 cargs.extend([ 8825 "-o", 8826 output 8827 ]) 8828 ret = C3dOutputs( 8829 root=execution.output_file("."), 8830 operations=[i.outputs(execution) if hasattr(i, "outputs") else None for i in operations], 8831 ) 8832 execution.run(cargs) 8833 return ret
C3D is a command-line tool for medical image processing.
Author: ITK-Snap Team
Arguments:
- input_: The input image to process.
- operations: The operations to perform.
- output: The output image.
- runner: Command runner.
Returns:
NamedTuple of outputs (described in
C3dOutputs).